From c4c30aedb8f1d1b5af237d5819c202c8139af395 Mon Sep 17 00:00:00 2001 From: andrej romanov <50377758+auumgn@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:30:18 +0200 Subject: [PATCH] fix more tests --- .../PublicProfileControllerTest.java | 20 ++++++++++++------- .../PublicRecordControllerLegacyTest.java | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java index 8a93b59925c..732d52f5a58 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java @@ -1,9 +1,6 @@ package org.orcid.frontend.web.controllers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -191,12 +188,21 @@ public void testGetPersonDetails() { assertNotNull(personDetails.getPublicGroupedEmails()); Map> emails = personDetails.getPublicGroupedEmails(); assertNotNull(emails); - assertEquals(1, emails.keySet().size()); - assertTrue(emails.containsKey("public_0000-0000-0000-0003@test.orcid.org")); + assertEquals(2, emails.keySet().size()); + assertTrue(emails.containsKey("public_0000-0000-0000-0003@test.orcid.org")); + assertTrue(emails.containsKey("public_0000-0000-0000-0003@orcid.org")); List publicEmails = emails.get("public_0000-0000-0000-0003@test.orcid.org"); assertEquals("public_0000-0000-0000-0003@test.orcid.org", publicEmails.get(0).getEmail()); + assertEquals("public_0000-0000-0000-0003@orcid.org", publicEmails.get(1).getEmail()); assertEquals(Visibility.PUBLIC, publicEmails.get(0).getVisibility()); - + assertEquals(Visibility.PUBLIC, publicEmails.get(0).getVisibility()); + assertEquals("APP-5555555555555555", publicEmails.get(0).getSource().retrieveSourcePath()); + assertEquals("Source Client 1", publicEmails.get(0).getSource().getSourceName().getContent()); + assertNull(publicEmails.get(0).getSource().getSourceOrcid()); + assertEquals("0000-0000-0000-0000", publicEmails.get(1).getSource().retrieveSourcePath()); + assertEquals("ORCID email validation", publicEmails.get(1).getSource().getSourceName().getContent()); + assertNull(publicEmails.get(1).getSource().getSourceOrcid()); + assertNotNull(personDetails.getPublicGroupedPersonExternalIdentifiers()); Map> extIds = personDetails.getPublicGroupedPersonExternalIdentifiers(); assertNotNull(extIds); diff --git a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerLegacyTest.java b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerLegacyTest.java index 291e08f649a..beeb3e14e1e 100644 --- a/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerLegacyTest.java +++ b/orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicRecordControllerLegacyTest.java @@ -115,7 +115,7 @@ public void testGetPublicRecord() { assertNotNull(record.getEmails()); assertEquals(2, record.getEmails().getEmails().size()); assertEquals("public_0000-0000-0000-0003@test.orcid.org", record.getEmails().getEmails().get(0).getValue()); - assertEquals("public_0000-0000-0000-0003@test.orcid.org", record.getEmails().getEmails().get(1).getValue()); + assertEquals("public_0000-0000-0000-0003@orcid.org", record.getEmails().getEmails().get(1).getValue()); assertEquals(Visibility.PUBLIC, record.getEmails().getEmails().get(0).getVisibility()); assertEquals(Visibility.PUBLIC, record.getEmails().getEmails().get(1).getVisibility());