use of org.orcid.jaxb.model.v3.dev1.common.SourceName in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateDuplicatedExtIds_duplicatesFoundTest.
@SuppressWarnings("deprecation")
@Test(expected = OrcidDuplicatedActivityException.class)
public void validateDuplicatedExtIds_duplicatesFoundTest() {
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceClientId sourceClientId = new SourceClientId();
sourceClientId.setPath("APP-00000000000000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("source name"));
when(source2.getSourceClientId()).thenReturn(sourceClientId);
ExternalIDs extIds1 = getExternalIDs();
ExternalIDs extIds2 = getExternalIDs();
activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
use of org.orcid.jaxb.model.v3.dev1.common.SourceName in project ORCID-Source by ORCID.
the class ActivityValidatorTest method checkDupesNormalized.
// validate normalization is being used
@Test(expected = OrcidDuplicatedActivityException.class)
public void checkDupesNormalized() {
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("agr");
id1.setValue("UPPER");
ExternalIDs ids1 = new ExternalIDs();
ids1.getExternalIdentifier().add(id1);
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.SELF);
id2.setType("agr");
id2.setValue("upper");
id2.setNormalized(new TransientNonEmptyString("upper"));
ExternalIDs ids2 = new ExternalIDs();
ids2.getExternalIdentifier().add(id2);
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceClientId sourceClientId = new SourceClientId();
sourceClientId.setPath("APP-00000000000000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("source name"));
when(source2.getSourceClientId()).thenReturn(sourceClientId);
activityValidator.checkExternalIdentifiersForDuplicates(ids1, ids2, source2, source1);
}
use of org.orcid.jaxb.model.v3.dev1.common.SourceName in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateDuplicatedExtIds_noDuplicatesTest.
/**
* VALIDATE DUPLICATED EXTERNAL IDENTIFIERS
*/
@SuppressWarnings("deprecation")
@Test
public void validateDuplicatedExtIds_noDuplicatesTest() {
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceOrcid sourceOrcid = new SourceOrcid();
sourceOrcid.setPath("0000-0000-0000-0000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("other source name"));
when(source2.getSourceOrcid()).thenReturn(sourceOrcid);
ExternalIDs extIds1 = getExternalIDs();
ExternalIDs extIds2 = getExternalIDs();
activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
Aggregations