From 7f2d2b38890875f8e8b9892dbc191677b42657b4 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:06:39 +0200 Subject: [PATCH] update tests --- ...rV2ApiServiceDelegator_ReadRecordTest.java | 14 +++++++---- ...rV3ApiServiceDelegator_ReadRecordTest.java | 23 +++++++++++++++---- 2 files changed, 27 insertions(+), 10 deletions(-) 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 db65c7b9882..21629f64516 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 @@ -228,24 +228,28 @@ public void testViewRecord() { Utils.verifyLastModified(email.getLastModifiedDate()); if (email.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.PRIVATE.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE.value(), email.getVisibility().value()); assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("0000-0000-0000-0003", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertNotNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); assertEquals("Credit Name", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { assertEquals("0000-0000-0000-0000", email.getSource().retrieveSourcePath()); assertNull(email.getSource().getSourceOrcid()); - assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); assertEquals("ORCID email validation", email.getSource().getSourceName().getContent()); } else { fail("Invalid email found: " + email.getEmail()); 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 65c5508cc1e..bb8ecf57165 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 @@ -235,21 +235,34 @@ public void testViewRecord() { assertNotNull(person.getEmails()); Utils.verifyLastModified(person.getEmails().getLastModifiedDate()); assertEquals("/0000-0000-0000-0003/email", person.getEmails().getPath()); - assertEquals(4, person.getEmails().getEmails().size()); + assertEquals(5, person.getEmails().getEmails().size()); for (Email email : person.getEmails().getEmails()) { Utils.verifyLastModified(email.getLastModifiedDate()); if (email.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.PUBLIC.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) { assertEquals("APP-5555555555555555", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.PRIVATE.value(), email.getVisibility().value()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE.value(), email.getVisibility().value()); + assertEquals("Source Client 1", email.getSource().getSourceName().getContent()); } else if (email.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) { assertEquals("0000-0000-0000-0003", email.getSource().retrieveSourcePath()); - assertEquals(Visibility.LIMITED.value(), email.getVisibility().value()); + assertNotNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.LIMITED.value(), email.getVisibility().value()); + assertEquals("Credit Name", email.getSource().getSourceName().getContent()); + } else if (email.getEmail().equals("public_0000-0000-0000-0003@orcid.org")) { + assertEquals("0000-0000-0000-0000", email.getSource().retrieveSourcePath()); + assertNull(email.getSource().getSourceOrcid()); + assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC.value(), email.getVisibility().value()); + assertEquals("ORCID email validation", email.getSource().getSourceName().getContent()); } else { fail("Invalid email found: " + email.getEmail()); }