From c17bb8a2e29c8d0830c6f15944a63fcf7c3f8cd6 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:22:31 +0200 Subject: [PATCH] more test fixes --- .../MemberV2ApiServiceDelegator_EmailsTest.java | 10 ++++++++-- ...berV2ApiServiceDelegator_ReadPersonTest.java | 9 ++++++++- ...berV2ApiServiceDelegator_ReadRecordTest.java | 4 ++++ .../MemberV3ApiServiceDelegator_EmailsTest.java | 6 +++++- ...berV3ApiServiceDelegator_ReadPersonTest.java | 17 ++++++++++++----- 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java index 25d8e13026e..3768a1cb475 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV2/server/delegator/MemberV2ApiServiceDelegator_EmailsTest.java @@ -88,10 +88,12 @@ public void testReadPublicScope_Emails() { assertNotNull(email); assertEquals("/0000-0000-0000-0003/email", email.getPath()); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); boolean found1 = false; boolean found2 = false; boolean found3 = false; + boolean found4 = false; + for (Email element : email.getEmails()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -100,7 +102,10 @@ public void testReadPublicScope_Emails() { found2 = true; } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found3 = true; - } else { + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found4 = true; + } + else { fail("Invalid put code " + element.getPutCode()); } @@ -108,6 +113,7 @@ public void testReadPublicScope_Emails() { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); } @Test 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 0a5bd4d75da..8d0c99e434c 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 @@ -154,6 +154,7 @@ public void testViewPerson() { 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")) { @@ -164,6 +165,8 @@ public void testViewPerson() { 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()); } @@ -173,6 +176,7 @@ public void testViewPerson() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); // External identifiers assertNotNull(p.getExternalIdentifiers()); @@ -516,7 +520,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { Utils.verifyLastModified(email.getLastModifiedDate()); assertEquals(4, 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")) { @@ -527,6 +531,8 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { 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()); } @@ -536,6 +542,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); this.assertAllPublicButEmails(p); } 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 21629f64516..c90c48de86a 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 @@ -861,6 +861,7 @@ private void testPerson(Person p, String orcid) { 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")) { @@ -869,6 +870,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()); } @@ -877,6 +880,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_EmailsTest.java b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java index bff3f1a21a6..08f209368cd 100644 --- a/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java +++ b/orcid-api-web/src/test/java/org/orcid/api/memberV3/server/delegator/MemberV3ApiServiceDelegator_EmailsTest.java @@ -99,10 +99,11 @@ public void testReadPublicScope_Emails() { assertNotNull(email); assertEquals("/0000-0000-0000-0003/email", email.getPath()); Utils.verifyLastModified(email.getLastModifiedDate()); - assertEquals(3, email.getEmails().size()); + assertEquals(4, email.getEmails().size()); boolean found1 = false; boolean found2 = false; boolean found3 = false; + boolean found4 = false; for (Email element : email.getEmails()) { Utils.verifyLastModified(element.getLastModifiedDate()); if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { @@ -111,6 +112,8 @@ public void testReadPublicScope_Emails() { found2 = true; } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found3 = true; + } if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + found4 = true; } else { fail("Invalid put code " + element.getPutCode()); } @@ -119,6 +122,7 @@ public void testReadPublicScope_Emails() { assertTrue(found1); assertTrue(found2); assertTrue(found3); + assertTrue(found4); } @Test 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 ed43bc74c25..c355b465201 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 @@ -160,6 +160,7 @@ public void testViewPerson() { 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")) { @@ -170,6 +171,8 @@ public void testViewPerson() { 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()); } @@ -179,6 +182,7 @@ public void testViewPerson() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); // External identifiers assertNotNull(p.getExternalIdentifiers()); @@ -521,19 +525,21 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { 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")) { found1 = true; - } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { + } else if (element.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { found2 = true; - } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { + } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { found3 = true; - } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { found4 = true; + } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { + found5 = true; } else { fail("Invalid email " + element.getEmail()); } @@ -543,6 +549,7 @@ public void testReadPrivateEmails_OtherThingsJustPublic_Person() { assertTrue(found2); assertTrue(found3); assertTrue(found4); + assertTrue(found5); this.assertAllPublicButEmails(p); }