Skip to content

Commit

Permalink
test mix up of dir and file
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-pol committed Aug 29, 2024
1 parent 311477e commit 8d316a6
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ public void doCall_is_happy() throws Exception {
verifyNoMoreInteractions(api);
}

@Test
public void doCall_with_dir_as_json() throws Exception {

var metadataKeys = new HashMap<String, String>();
var jsonFile = "src/test/resources/debug-etc"; // invalid json file, don't care
var client = new DataverseClient(new DataverseClientConfig(new URI("http://localhost:8080"), "apiToken"));

// command under test
CollectionCreateDataset cmd = getCmd("A", metadataKeys, jsonFile, client);
cmd.doCall();

assertThat(stderr.toString()).isEqualTo("""
A: FAILED: Exception type = IOException, message = Is a directory
""");
assertThat(stdout.toString()).isEqualTo("""
INFO Starting batch processing
INFO Processing item 1 of 1
INFO Finished batch processing of 1 items
""");
}

private static CollectionCreateDataset getCmd(String target, HashMap<String, String> metadataKeys, String json, final DataverseClient client)
throws NoSuchFieldException, IllegalAccessException {

Expand Down

0 comments on commit 8d316a6

Please sign in to comment.