use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.
the class OtherNameManagerTest method testAddOtherNameToUnclaimedRecordPreserveOtherNameVisibility.
@Test
public void testAddOtherNameToUnclaimedRecordPreserveOtherNameVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
OtherName otherName = getOtherName();
otherName = otherNameManager.createOtherName(unclaimedOrcid, otherName, true);
otherName = otherNameManager.getOtherName(unclaimedOrcid, otherName.getPutCode());
assertNotNull(otherName);
assertEquals(Visibility.PUBLIC, otherName.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.
the class OtherNameManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
OtherName otherName = getOtherName();
otherName.setContent(otherName.getContent() + " fromUI");
otherName = otherNameManager.createOtherName(claimedOrcid, otherName, false);
otherName = otherNameManager.getOtherName(claimedOrcid, otherName.getPutCode());
assertNotNull(otherName);
assertEquals(Long.valueOf(1), otherName.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.
the class OtherNameManagerTest method getOtherName.
private OtherName getOtherName() {
OtherName otherName = new OtherName();
otherName.setContent("other-name");
otherName.setVisibility(Visibility.PUBLIC);
return otherName;
}
use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.
the class OtherNameManagerTest method testAddOtherNameToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddOtherNameToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
OtherName otherName = getOtherName();
otherName = otherNameManager.createOtherName(claimedOrcid, otherName, true);
otherName = otherNameManager.getOtherName(claimedOrcid, otherName.getPutCode());
assertNotNull(otherName);
assertEquals(Visibility.LIMITED, otherName.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.OtherName in project ORCID-Source by ORCID.
the class OtherNameManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
OtherName otherName = getOtherName();
otherName.setContent(otherName.getContent() + " fromAPI");
otherName = otherNameManager.createOtherName(claimedOrcid, otherName, true);
otherName = otherNameManager.getOtherName(claimedOrcid, otherName.getPutCode());
assertNotNull(otherName);
assertEquals(Long.valueOf(0), otherName.getDisplayIndex());
}
Aggregations