Skip to content

Commit

Permalink
fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn committed Nov 20, 2024
1 parent d1d5b37 commit c4c30ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -191,12 +188,21 @@ public void testGetPersonDetails() {
assertNotNull(personDetails.getPublicGroupedEmails());
Map<String, List<Email>> emails = personDetails.getPublicGroupedEmails();
assertNotNull(emails);
assertEquals(1, emails.keySet().size());
assertTrue(emails.containsKey("[email protected]"));
assertEquals(2, emails.keySet().size());
assertTrue(emails.containsKey("[email protected]"));
assertTrue(emails.containsKey("[email protected]"));
List<Email> publicEmails = emails.get("[email protected]");
assertEquals("[email protected]", publicEmails.get(0).getEmail());
assertEquals("[email protected]", publicEmails.get(1).getEmail());

Check failure on line 196 in orcid-web/src/test/java/org/orcid/frontend/web/controllers/PublicProfileControllerTest.java

View workflow job for this annotation

GitHub Actions / Unit test report for orcid-web

org.orcid.frontend.web.controllers.PublicProfileControllerTest ► testGetPersonDetails

Failed test found in: orcid-web/target/surefire-reports/TEST-org.orcid.frontend.web.controllers.PublicProfileControllerTest.xml Error: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
Raw output
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
	at org.orcid.frontend.web.controllers.PublicProfileControllerTest.testGetPersonDetails(PublicProfileControllerTest.java:196)
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<String, List<PersonExternalIdentifier>> extIds = personDetails.getPublicGroupedPersonExternalIdentifiers();
assertNotNull(extIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testGetPublicRecord() {
assertNotNull(record.getEmails());
assertEquals(2, record.getEmails().getEmails().size());
assertEquals("[email protected]", record.getEmails().getEmails().get(0).getValue());
assertEquals("public_0000-0000-0000-0003@test.orcid.org", record.getEmails().getEmails().get(1).getValue());
assertEquals("[email protected]", record.getEmails().getEmails().get(1).getValue());
assertEquals(Visibility.PUBLIC, record.getEmails().getEmails().get(0).getVisibility());
assertEquals(Visibility.PUBLIC, record.getEmails().getEmails().get(1).getVisibility());

Expand Down

0 comments on commit c4c30ae

Please sign in to comment.