use of org.orcid.jaxb.model.record.summary_rc2.Fundings in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testGroupFundings_groupOnlyPublicFundings1.
@Test
public void testGroupFundings_groupOnlyPublicFundings1() {
FundingSummary s1 = getFundingSummary("Public 1", "ext-id-1", Visibility.PUBLIC);
FundingSummary s2 = getFundingSummary("Limited 1", "ext-id-2", Visibility.LIMITED);
FundingSummary s3 = getFundingSummary("Private 1", "ext-id-3", Visibility.PRIVATE);
FundingSummary s4 = getFundingSummary("Public 2", "ext-id-4", Visibility.PUBLIC);
FundingSummary s5 = getFundingSummary("Limited 2", "ext-id-5", Visibility.LIMITED);
FundingSummary s6 = getFundingSummary("Private 2", "ext-id-6", Visibility.PRIVATE);
FundingSummary s7 = getFundingSummary("Public 3", "ext-id-7", Visibility.PUBLIC);
FundingSummary s8 = getFundingSummary("Limited 3", "ext-id-8", Visibility.LIMITED);
FundingSummary s9 = getFundingSummary("Private 3", "ext-id-9", Visibility.PRIVATE);
List<FundingSummary> fundingList = Arrays.asList(s1, s2, s3, s4, s5, s6, s7, s8, s9);
/**
* They should be grouped as
*
* Group 1: Public 1
* Group 2: Public 2
* Group 3: Public 3
* */
Fundings fundings = profileFundingManager.groupFundings(fundingList, true);
assertNotNull(fundings);
assertEquals(3, fundings.getFundingGroup().size());
assertEquals(1, fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, fundings.getFundingGroup().get(0).getFundingSummary().size());
assertEquals("ext-id-1", fundings.getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("Public 1", fundings.getFundingGroup().get(0).getFundingSummary().get(0).getTitle().getTitle().getContent());
assertEquals(1, fundings.getFundingGroup().get(1).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, fundings.getFundingGroup().get(1).getFundingSummary().size());
assertEquals("ext-id-4", fundings.getFundingGroup().get(1).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("Public 2", fundings.getFundingGroup().get(1).getFundingSummary().get(0).getTitle().getTitle().getContent());
assertEquals(1, fundings.getFundingGroup().get(2).getIdentifiers().getExternalIdentifier().size());
assertEquals(1, fundings.getFundingGroup().get(2).getFundingSummary().size());
assertEquals("ext-id-7", fundings.getFundingGroup().get(2).getIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("Public 3", fundings.getFundingGroup().get(2).getFundingSummary().get(0).getTitle().getTitle().getContent());
}
Aggregations