Skip to content

Commit

Permalink
Working on unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Apr 2, 2024
1 parent 6e07ffa commit 63407d9
Showing 1 changed file with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Date;
Expand Down Expand Up @@ -150,13 +151,32 @@ public void getSummaryTest() {
assertNotNull(summary);
assertEquals(3, summary.getEmploymentAffiliationsCount());
assertEquals(3, summary.getEmploymentAffiliations().size());
assertEquals("EMPLOYMENT-2", summary.getEmploymentAffiliations().get(0).getOrganizationName());
assertEquals("EMPLOYMENT-1", summary.getEmploymentAffiliations().get(1).getOrganizationName());
assertEquals("EMPLOYMENT-0", summary.getEmploymentAffiliations().get(2).getOrganizationName());
boolean found0 = false, found1 = false, found2 = false;
for(int i = 0; i < 3; i++ ) {
String name = summary.getEmploymentAffiliations().get(i).getOrganizationName();
switch(name) {
case "EMPLOYMENT-0":
found0 = true;
break;
case "EMPLOYMENT-1":
found1 = true;
break;
case "EMPLOYMENT-2":
found2 = true;
break;
}
}
assertTrue(found0);
assertTrue(found1);
assertTrue(found2);

assertEquals(1, summary.getExternalIdentifiers().size());
assertEquals("0", summary.getExternalIdentifiers().get(0).getId());
assertEquals("0000", summary.getExternalIdentifiers().get(0).getReference());

assertEquals("ORCID Test Credit Name", summary.getName());
assertEquals("https://test.orcid.org/0000-0000-0000-0000", summary.getOrcid());

summary.getExternalIdentifiers();
summary.getName();
summary.getOrcid();
summary.getPeerReviewPublicationGrants();
summary.getPeerReviewsTotal();
summary.getProfessionalActivities();
Expand Down Expand Up @@ -191,7 +211,7 @@ private List<AffiliationGroupForm> getAffiliationGroup(AffiliationType affiliati
agf.setActivePutCode(1L);
agf.setActiveVisibility(Visibility.PUBLIC.name());
agf.setAffiliationType(affiliationType);
affiliationGroupForms.add(agf);
affiliationGroupForms.add(i, agf);
}
return affiliationGroupForms;
}
Expand Down Expand Up @@ -279,7 +299,7 @@ private List<FundingGroup> getFundingGroups() {
}
fg.getFundings().add(ff);
}
fundings.add(fg);
fundings.add(i, fg);
}

return fundings;
Expand Down

0 comments on commit 63407d9

Please sign in to comment.