Search in sources :

Example 1 with IdentifierTypePOJOConverter

use of org.orcid.core.adapter.impl.IdentifierTypePOJOConverter in project ORCID-Source by ORCID.

the class IdentifierTypeConverterTest method testToPojo.

@Test
public void testToPojo() {
    IdentifierTypeEntity entity1 = new IdentifierTypeEntity();
    entity1.setId(1l);
    entity1.setName("NAME_TEST");
    entity1.setIsDeprecated(true);
    entity1.setResolutionPrefix("prefix");
    entity1.setValidationRegex("validation");
    entity1.setDateCreated(new Date(10, 10, 10));
    entity1.setLastModified(new Date(11, 11, 11));
    ClientDetailsEntity client = new ClientDetailsEntity();
    client.setClientName("clientName");
    entity1.setSourceClient(client);
    IdentifierType id = new IdentifierTypePOJOConverter().fromEntity(entity1);
    assertEquals(Long.valueOf(1l), id.getPutCode());
    assertEquals("name-test", id.getName());
    assertEquals(true, id.getDeprecated());
    assertEquals("prefix", id.getResolutionPrefix());
    assertEquals("validation", id.getValidationRegex());
    assertEquals(new Date(10, 10, 10), id.getDateCreated());
    assertEquals(new Date(11, 11, 11), id.getLastModified());
    assertEquals("clientName", id.getSourceClient().getClientName());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) IdentifierTypeEntity(org.orcid.persistence.jpa.entities.IdentifierTypeEntity) IdentifierTypePOJOConverter(org.orcid.core.adapter.impl.IdentifierTypePOJOConverter) IdentifierType(org.orcid.pojo.IdentifierType) Date(java.util.Date) BaseTest(org.orcid.core.BaseTest) Test(org.junit.Test)

Example 2 with IdentifierTypePOJOConverter

use of org.orcid.core.adapter.impl.IdentifierTypePOJOConverter in project ORCID-Source by ORCID.

the class IdentifierTypeConverterTest method testFromPojo.

@Test
public void testFromPojo() {
    IdentifierType id = new IdentifierType();
    id.setPutCode(1l);
    id.setName("name-test");
    id.setDeprecated(true);
    id.setResolutionPrefix("prefix");
    id.setValidationRegex("validation");
    id.setDateCreated(new Date(10, 10, 10));
    id.setLastModified(new Date(11, 11, 11));
    ClientDetailsEntity client = new ClientDetailsEntity();
    client.setClientName("clientName");
    id.setSourceClient(client);
    IdentifierTypeEntity entity = new IdentifierTypePOJOConverter().fromPojo(id);
    assertEquals(Long.valueOf(1l), entity.getId());
    assertEquals("NAME_TEST", entity.getName());
    assertEquals(true, entity.getIsDeprecated());
    assertEquals("prefix", entity.getResolutionPrefix());
    assertEquals("validation", entity.getValidationRegex());
    assertEquals(new Date(10, 10, 10), entity.getDateCreated());
    assertEquals(new Date(11, 11, 11), entity.getLastModified());
    assertEquals("clientName", entity.getSourceClient().getClientName());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) IdentifierTypeEntity(org.orcid.persistence.jpa.entities.IdentifierTypeEntity) IdentifierTypePOJOConverter(org.orcid.core.adapter.impl.IdentifierTypePOJOConverter) IdentifierType(org.orcid.pojo.IdentifierType) Date(java.util.Date) BaseTest(org.orcid.core.BaseTest) Test(org.junit.Test)

Aggregations

Date (java.util.Date)2 Test (org.junit.Test)2 BaseTest (org.orcid.core.BaseTest)2 IdentifierTypePOJOConverter (org.orcid.core.adapter.impl.IdentifierTypePOJOConverter)2 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)2 IdentifierTypeEntity (org.orcid.persistence.jpa.entities.IdentifierTypeEntity)2 IdentifierType (org.orcid.pojo.IdentifierType)2