Search in sources :

Example 6 with PostedStaffPerson

use of gov.ca.cwds.rest.api.domain.cms.PostedStaffPerson in project API by ca-cwds.

the class StaffPersonServiceTest method createReturnsCorrectPostedPerson.

@SuppressWarnings("javadoc")
@Test
public void createReturnsCorrectPostedPerson() throws Exception {
    String id = "ABC";
    StaffPerson staffPersonDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/StaffPerson/valid/valid.json"), StaffPerson.class);
    gov.ca.cwds.data.persistence.cms.StaffPerson toCreate = new gov.ca.cwds.data.persistence.cms.StaffPerson(id, staffPersonDomain, "2017-01-07");
    StaffPerson request = new StaffPerson(toCreate);
    when(staffPersonDao.create(any(gov.ca.cwds.data.persistence.cms.StaffPerson.class))).thenReturn(toCreate);
    PostedStaffPerson expected = new PostedStaffPerson(toCreate);
    PostedStaffPerson returned = staffPersonService.create(request);
    assertThat(returned, is(expected));
}
Also used : PostedStaffPerson(gov.ca.cwds.rest.api.domain.cms.PostedStaffPerson) StaffPerson(gov.ca.cwds.rest.api.domain.cms.StaffPerson) PostedStaffPerson(gov.ca.cwds.rest.api.domain.cms.PostedStaffPerson) Test(org.junit.Test)

Aggregations

PostedStaffPerson (gov.ca.cwds.rest.api.domain.cms.PostedStaffPerson)6 StaffPerson (gov.ca.cwds.rest.api.domain.cms.StaffPerson)6 Test (org.junit.Test)5 ServiceException (gov.ca.cwds.rest.services.ServiceException)4 EntityExistsException (javax.persistence.EntityExistsException)1