From 4bec69d73f619196c0e7d92d8625000c068925a7 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:36:51 +0200 Subject: [PATCH] more tests --- .../MemberV2ApiServiceDelegator_ReadPersonTest.java | 12 ++++++++---- .../MemberV2ApiServiceDelegator_ReadRecordTest.java | 10 +++++++--- .../MemberV3ApiServiceDelegator_ReadPersonTest.java | 8 ++++++-- .../MemberV3ApiServiceDelegator_ReadRecordTest.java | 13 ++++++++++--- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java index 8d0c99e434..863aefb101 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadPersonTest.java @@ -148,13 +148,12 @@ public void testViewPerson() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(4, email.getEmails().size()); + assertEquals(5, email.getEmails().size()); found1 = false; found2 = false; found3 = false; found4 = false; - found5 = false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -360,12 +359,14 @@ private void testPerson(Person p, String orcid) { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); assertEquals("public_0000-0000-0000-0003@test.orcid.org", email.getEmails().get(0).getEmail()); + assertEquals("public_0000-0000-0000-0003@orcid.org", email.getEmails().get(1).getEmail()); found1 = false; found2 = false; found3 = false; + found4 = false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -374,6 +375,8 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found3 = true; + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found4 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -382,6 +385,7 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); // External identifiers assertNotNull(p.getExternalIdentifiers()); @@ -518,7 +522,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(4, email.getEmails().size()); + assertEquals(5, email.getEmails().size()); boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java index c90c48de86..411910f718 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_ReadRecordTest.java @@ -855,7 +855,7 @@ private void testPerson(Person p, String orcid) { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); assertEquals("public_0000-0000-0000-0003@test.orcid.org", email.getEmails().get(0).getEmail()); found1 = false; @@ -1021,9 +1021,9 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(4, email.getEmails().size()); + assertEquals(5, email.getEmails().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -1034,6 +1034,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { found3 = true; } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { found4 = true; + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found5 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -1043,6 +1045,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); + this.assertAllPublicButEmails(p); } diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java index c355b46520..3a70f98046 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadPersonTest.java @@ -154,7 +154,7 @@ public void testViewPerson() { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(4, email.getEmails().size()); + assertEquals(5, email.getEmails().size()); found1 = false; found2 = false; @@ -366,12 +366,13 @@ private void testPerson(Person p, String orcid) { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); assertEquals("public_0000-0000-0000-0003@test.orcid.org", email.getEmails().get(0).getEmail()); found1 = false; found2 = false; found3 = false; + found4= false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -380,6 +381,8 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found3 = true; + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found4 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -388,6 +391,7 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); // External identifiers assertNotNull(p.getExternalIdentifiers()); diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java index bb8ecf5716..48ad1611ad 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_ReadRecordTest.java @@ -1063,12 +1063,13 @@ private void testPerson(Person p, String orcid) { Emails email = p.getEmails(); assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); assertEquals("public_0000-0000-0000-0003@test.orcid.org", email.getEmails().get(0).getEmail()); found1 = false; found2 = false; found3 = false; + found4 = false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -1077,6 +1078,8 @@ private void testPerson(Person p, String orcid) { found2 = true; } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found3 = true; + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found4 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -1085,6 +1088,7 @@ private void testPerson(Person p, String orcid) { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); // External identifiers assertNotNull(p.getExternalIdentifiers()); @@ -1224,9 +1228,9 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { assertNotNull(email); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(4, email.getEmails().size()); + assertEquals(5, email.getEmails().size()); - boolean found1 = false, found2 = false, found3 = false, found4 = false; + boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false; for (Email element : email.getEmails()) { if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -1237,6 +1241,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { found3 = true; } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { found4 = true; + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found5 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -1246,6 +1252,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Record() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); this.assertAllPublicButEmails(p); }