From a55d31f19f9d422e2160d15b68d9519c9e29d394 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 4 Nov 2024 16:19:17 +0000 Subject: [PATCH 1/3] Fixed: unit test assertion in JsonParserTest --- .../java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java index f241a5d1dda..236344a9200 100644 --- a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java @@ -283,7 +283,7 @@ public void parseDataverseDTO() throws JsonParseException { assertEquals("We do all the science.", actual.getDescription()); assertEquals("LABORATORY", actual.getDataverseType().toString()); assertEquals(2, actual.getDataverseContacts().size()); - assertEquals("pi@example.edu,student@example.edu", actual.getDataverseContacts().get(0).getContactEmail()); + assertEquals("pi@example.edu", actual.getDataverseContacts().get(0).getContactEmail()); assertEquals(0, actual.getDataverseContacts().get(0).getDisplayOrder()); assertEquals(1, actual.getDataverseContacts().get(1).getDisplayOrder()); } catch (IOException ioe) { From 1ed0d304307e8839493b00aa48cf1002ec8e5afa Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 4 Nov 2024 16:24:14 +0000 Subject: [PATCH 2/3] Added: assertion to JsonParserTest --- .../java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java index 236344a9200..52e9c6de678 100644 --- a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java @@ -284,6 +284,7 @@ public void parseDataverseDTO() throws JsonParseException { assertEquals("LABORATORY", actual.getDataverseType().toString()); assertEquals(2, actual.getDataverseContacts().size()); assertEquals("pi@example.edu", actual.getDataverseContacts().get(0).getContactEmail()); + assertEquals("student@example.edu", actual.getDataverseContacts().get(1).getContactEmail()); assertEquals(0, actual.getDataverseContacts().get(0).getDisplayOrder()); assertEquals(1, actual.getDataverseContacts().get(1).getDisplayOrder()); } catch (IOException ioe) { From b1dcb00b8ad46549e7f74304b11e2dcc9d3a1e64 Mon Sep 17 00:00:00 2001 From: GPortas Date: Mon, 4 Nov 2024 16:25:50 +0000 Subject: [PATCH 3/3] Refactor: JsonParserTest.parseDataverseDTO --- .../iq/dataverse/util/json/JsonParserTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java index 52e9c6de678..d1cb30e2bc3 100644 --- a/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/util/json/JsonParserTest.java @@ -277,16 +277,17 @@ public void parseDataverseDTO() throws JsonParseException { try (FileReader reader = new FileReader("doc/sphinx-guides/source/_static/api/dataverse-complete.json")) { dvJson = Json.createReader(reader).readObject(); DataverseDTO actual = sut.parseDataverseDTO(dvJson); + List actualDataverseContacts = actual.getDataverseContacts(); assertEquals("Scientific Research", actual.getName()); assertEquals("science", actual.getAlias()); assertEquals("Scientific Research University", actual.getAffiliation()); assertEquals("We do all the science.", actual.getDescription()); assertEquals("LABORATORY", actual.getDataverseType().toString()); - assertEquals(2, actual.getDataverseContacts().size()); - assertEquals("pi@example.edu", actual.getDataverseContacts().get(0).getContactEmail()); - assertEquals("student@example.edu", actual.getDataverseContacts().get(1).getContactEmail()); - assertEquals(0, actual.getDataverseContacts().get(0).getDisplayOrder()); - assertEquals(1, actual.getDataverseContacts().get(1).getDisplayOrder()); + assertEquals(2, actualDataverseContacts.size()); + assertEquals("pi@example.edu", actualDataverseContacts.get(0).getContactEmail()); + assertEquals("student@example.edu", actualDataverseContacts.get(1).getContactEmail()); + assertEquals(0, actualDataverseContacts.get(0).getDisplayOrder()); + assertEquals(1, actualDataverseContacts.get(1).getDisplayOrder()); } catch (IOException ioe) { throw new JsonParseException("Couldn't read test file", ioe); }