use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord.
@Test
public void testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord() {
when(profileEntityManager.orcidExists(anyString())).thenReturn(false);
Funding funding = getFundingWithOrcidContributor();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("original credit name", contributor.getCreditName().getContent());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPublicName.
@Test
public void testFilterContributorPrivateDataForFundingWithPublicName() {
when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn("a public name");
Funding funding = getFundingWithOrcidContributor();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("a public name", contributor.getCreditName().getContent());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingWithContributorWithoutOrcid.
private Funding getFundingWithContributorWithoutOrcid() {
Funding funding = new Funding();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title("funding with contributor without ORCID record"));
funding.setTitle(fundingTitle);
funding.setContributors(getFundingContributorWithoutOrcid());
return funding;
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPrivateName.
@Test
public void testFilterContributorPrivateDataForFundingWithPrivateName() {
when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn(null);
Funding funding = getFundingWithOrcidContributor();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("", contributor.getCreditName().getContent());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_DontGroupFundingsWithoutExtIds_Test.
/**
* Test that two groups without ext ids dont get grouped
*/
@Test
public void groupFundings_DontGroupFundingsWithoutExtIds_Test() {
ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
Map<String, FundingSummary> fundings = generateFundings();
// Group the first group
FundingSummary funding8 = fundings.get("funding-8");
FundingSummary funding9 = fundings.get("funding-9");
generator.group(funding8);
generator.group(funding9);
List<ActivitiesGroup> groups = generator.getGroups();
assertNotNull(groups);
assertEquals(2, groups.size());
// Check there are two activities in each group
assertEquals(1, groups.get(0).getActivities().size());
assertEquals(1, groups.get(1).getActivities().size());
// Check there are five external ids in each group
assertEquals(0, groups.get(0).getGroupKeys().size());
assertEquals(0, groups.get(1).getGroupKeys().size());
checkActivityIsOnGroups(funding8, groups);
checkActivityIsOnGroups(funding9, groups);
checkActivitiesDontBelongsToTheSameGroup(groups, funding8, funding9);
}
Aggregations