Search in sources :

Example 36 with Fundings

use of org.orcid.jaxb.model.record.summary_rc3.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());
}
Also used : Fundings(org.orcid.jaxb.model.record.summary_v2.Fundings) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Test (org.junit.Test)30 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)22 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)18 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)9 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)8 Educations (org.orcid.jaxb.model.record.summary_v2.Educations)8 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)8 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Works (org.orcid.jaxb.model.record.summary_v2.Works)8 BaseTest (org.orcid.core.BaseTest)7 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)5 Fundings (org.orcid.jaxb.model.record.summary_rc2.Fundings)4 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)4 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)4 Address (org.orcid.jaxb.model.record_v2.Address)4 Email (org.orcid.jaxb.model.record_v2.Email)4 Keyword (org.orcid.jaxb.model.record_v2.Keyword)4 Name (org.orcid.jaxb.model.record_v2.Name)4