Search in sources :

Example 51 with ChildClient

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));
}
Also used : ChildClient(gov.ca.cwds.rest.api.domain.cms.ChildClient) Test(org.junit.Test)

Example 52 with ChildClient

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()));
}
Also used : ChildClient(gov.ca.cwds.rest.api.domain.cms.ChildClient) Test(org.junit.Test)

Example 53 with ChildClient

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));
}
Also used : ChildClient(gov.ca.cwds.rest.api.domain.cms.ChildClient) Test(org.junit.Test)

Example 54 with ChildClient

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));
}
Also used : Response(gov.ca.cwds.rest.api.Response) ChildClient(gov.ca.cwds.rest.api.domain.cms.ChildClient) Test(org.junit.Test)

Aggregations

ChildClient (gov.ca.cwds.rest.api.domain.cms.ChildClient)54 Test (org.junit.Test)47 Response (gov.ca.cwds.rest.api.Response)42 Client (gov.ca.cwds.rest.api.domain.cms.Client)42 ReferralClient (gov.ca.cwds.rest.api.domain.cms.ReferralClient)42 PostedScreeningToReferral (gov.ca.cwds.rest.api.domain.PostedScreeningToReferral)41 ScreeningToReferral (gov.ca.cwds.rest.api.domain.ScreeningToReferral)41 Address (gov.ca.cwds.rest.api.domain.cms.Address)41 Allegation (gov.ca.cwds.rest.api.domain.cms.Allegation)41 ClientAddress (gov.ca.cwds.rest.api.domain.cms.ClientAddress)41 CmsReferral (gov.ca.cwds.rest.api.domain.cms.CmsReferral)41 CrossReport (gov.ca.cwds.rest.api.domain.cms.CrossReport)41 LongText (gov.ca.cwds.rest.api.domain.cms.LongText)41 Referral (gov.ca.cwds.rest.api.domain.cms.Referral)41 LinkedHashSet (java.util.LinkedHashSet)41 Set (java.util.Set)41 Reporter (gov.ca.cwds.rest.api.domain.cms.Reporter)40 ErrorMessage (gov.ca.cwds.rest.api.domain.error.ErrorMessage)21 ExpectedException (org.junit.rules.ExpectedException)17 Participant (gov.ca.cwds.rest.api.domain.Participant)1