use of org.orcid.core.adapter.impl.jsonidentifiers.WorkExternalIDsConverter in project ORCID-Source by ORCID.
the class WorkExternalIdentifiersConversionsTest method testConvertToExternalIDs.
@Test
public void testConvertToExternalIDs() {
WorkExternalIDsConverter conv = new WorkExternalIDsConverter();
String externalIdentifiersAsString = expectedIDs;
ExternalIDs ids = conv.convertFrom(externalIdentifiersAsString, null);
assertEquals(Relationship.SELF, ids.getExternalIdentifier().get(0).getRelationship());
assertEquals(new Url("http://what.com"), ids.getExternalIdentifier().get(0).getUrl());
assertEquals("doi", ids.getExternalIdentifier().get(0).getType());
assertEquals("value", ids.getExternalIdentifier().get(0).getValue());
assertEquals(Relationship.PART_OF, ids.getExternalIdentifier().get(1).getRelationship());
assertEquals(new Url("http://whatnow.com"), ids.getExternalIdentifier().get(1).getUrl());
assertEquals("source-work-id", ids.getExternalIdentifier().get(1).getType());
assertEquals("value2", ids.getExternalIdentifier().get(1).getValue());
}
use of org.orcid.core.adapter.impl.jsonidentifiers.WorkExternalIDsConverter in project ORCID-Source by ORCID.
the class WorkExternalIdentifiersConversionsTest method testConvertFromExternalIDs.
@Test
public void testConvertFromExternalIDs() {
WorkExternalIDsConverter conv = new WorkExternalIDsConverter();
ExternalID id = new ExternalID();
id.setRelationship(Relationship.SELF);
id.setType("doi");
id.setUrl(new Url("http://what.com"));
id.setValue("value");
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.PART_OF);
id2.setType("source-work-id");
id2.setUrl(new Url("http://whatnow.com"));
id2.setValue("value2");
ExternalIDs ids = new ExternalIDs();
ids.getExternalIdentifier().add(id);
ids.getExternalIdentifier().add(id2);
String externalIdentifiersAsString = conv.convertTo(ids, null);
assertEquals(expectedIDs, externalIdentifiersAsString);
}
Aggregations