use of gov.ca.cwds.rest.api.domain.cms.ChildClient in project API by ca-cwds.
the class ChildClientServiceTest method findReturnsChildClientReportWhenFound.
@SuppressWarnings("javadoc")
@Test
public void findReturnsChildClientReportWhenFound() throws Exception {
ChildClient expected = MAPPER.readValue(fixture("fixtures/domain/legacy/ChildClient/valid/valid.json"), ChildClient.class);
gov.ca.cwds.data.persistence.cms.ChildClient childCleint = new gov.ca.cwds.data.persistence.cms.ChildClient(expected.getVictimClientId(), expected, "0X5");
when(childClientDao.find(eq(expected.getVictimClientId()))).thenReturn(childCleint);
ChildClient found = childClientService.find("ABC1234567");
assertThat(found, is(expected));
}
use of gov.ca.cwds.rest.api.domain.cms.ChildClient in project API by ca-cwds.
the class ChildClientServiceTest method createReturnsNonNull.
@SuppressWarnings("javadoc")
@Test
public void createReturnsNonNull() throws Exception {
ChildClient childClientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/ChildClient/valid/valid.json"), ChildClient.class);
gov.ca.cwds.data.persistence.cms.ChildClient toCreate = new gov.ca.cwds.data.persistence.cms.ChildClient(childClientDomain.getVictimClientId(), childClientDomain, "ABC");
ChildClient request = new ChildClient(toCreate);
when(childClientDao.create(any(gov.ca.cwds.data.persistence.cms.ChildClient.class))).thenReturn(toCreate);
ChildClient postedChildClient = childClientService.create(request);
assertThat(postedChildClient, is(notNullValue()));
}
use of gov.ca.cwds.rest.api.domain.cms.ChildClient in project API by ca-cwds.
the class ChildClientServiceTest method createReturnsCorrectPostedChildClient.
@SuppressWarnings("javadoc")
@Test
public void createReturnsCorrectPostedChildClient() throws Exception {
ChildClient childClientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/ChildClient/valid/valid.json"), ChildClient.class);
gov.ca.cwds.data.persistence.cms.ChildClient toCreate = new gov.ca.cwds.data.persistence.cms.ChildClient(childClientDomain.getVictimClientId(), childClientDomain, "ABC");
ChildClient request = new ChildClient(toCreate);
when(childClientDao.create(any(gov.ca.cwds.data.persistence.cms.ChildClient.class))).thenReturn(toCreate);
ChildClient expected = new ChildClient(toCreate);
ChildClient returned = childClientService.create(request);
assertThat(returned, is(expected));
}
use of gov.ca.cwds.rest.api.domain.cms.ChildClient in project API by ca-cwds.
the class ChildClientServiceTest method createReturnsPostedCrossReportClass.
// create test
@SuppressWarnings("javadoc")
@Test
public void createReturnsPostedCrossReportClass() throws Exception {
ChildClient childClientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/ChildClient/valid/valid.json"), ChildClient.class);
gov.ca.cwds.data.persistence.cms.ChildClient toCreate = new gov.ca.cwds.data.persistence.cms.ChildClient(childClientDomain.getVictimClientId(), childClientDomain, "ABC");
ChildClient request = new ChildClient(toCreate);
when(childClientDao.create(any(gov.ca.cwds.data.persistence.cms.ChildClient.class))).thenReturn(toCreate);
Response response = childClientService.create(request);
assertThat(response.getClass(), is(ChildClient.class));
}
Aggregations