Search in sources :

Example 81 with Response

use of gov.ca.cwds.rest.api.Response in project API by ca-cwds.

the class SystemCodeServiceTest method findReturnsEmptyWhenNotFound.

@Test
public void findReturnsEmptyWhenNotFound() throws Exception {
    gov.ca.cwds.data.persistence.cms.SystemCode[] foundSysCodes = new gov.ca.cwds.data.persistence.cms.SystemCode[0];
    when(systemCodeDao.findByForeignKeyMetaTable("ABC1234567")).thenReturn(foundSysCodes);
    Response found = systemCodeService.find("ABC1234567");
    SystemCodeListResponse expected = new SystemCodeListResponse(new HashSet<SystemCode>());
    assertEquals(found, expected);
}
Also used : SystemCodeListResponse(gov.ca.cwds.rest.api.domain.cms.SystemCodeListResponse) Response(gov.ca.cwds.rest.api.Response) SystemMetaListResponse(gov.ca.cwds.rest.api.domain.cms.SystemMetaListResponse) SystemCode(gov.ca.cwds.rest.api.domain.cms.SystemCode) SystemCodeListResponse(gov.ca.cwds.rest.api.domain.cms.SystemCodeListResponse) Test(org.junit.Test)

Example 82 with Response

use of gov.ca.cwds.rest.api.Response in project API by ca-cwds.

the class StaffPersonServiceTest method deleteReturnsNullWhenNotFound.

@SuppressWarnings("javadoc")
@Test
public void deleteReturnsNullWhenNotFound() throws Exception {
    Response found = staffPersonService.delete("ABC");
    assertThat(found, is(nullValue()));
}
Also used : Response(gov.ca.cwds.rest.api.Response) Test(org.junit.Test)

Example 83 with Response

use of gov.ca.cwds.rest.api.Response in project API by ca-cwds.

the class PersonServiceTest method createReturnsPostedPerson.

/*
   * create tests
   */
@Test
public void createReturnsPostedPerson() throws Exception {
    gov.ca.cwds.data.persistence.ns.Address toCreateAddress = new gov.ca.cwds.data.persistence.ns.Address(1L, "742 Evergreen Terrace", "Springfield", "WA", new Integer(98700), "Home");
    Set<PersonAddress> personAddresses = new HashSet<>();
    PersonAddress personAddress = new PersonAddress();
    personAddress.setAddress(toCreateAddress);
    personAddresses.add(personAddress);
    gov.ca.cwds.data.persistence.ns.Person toCreate = new gov.ca.cwds.data.persistence.ns.Person(2L, "Bart", "Simpson", "M", DomainChef.uncookDateString("2013-10-31"), "1234556789", personAddresses, null, null, null, null);
    Person request = new Person(toCreate);
    when(personDao.create(any(gov.ca.cwds.data.persistence.ns.Person.class))).thenReturn(toCreate);
    when(personDao.find(any(gov.ca.cwds.data.persistence.ns.Person.class))).thenReturn(toCreate);
    Response response = personService.create(request);
    assertThat(response.getClass(), is(PostedPerson.class));
}
Also used : PersonAddress(gov.ca.cwds.data.persistence.ns.PersonAddress) Address(gov.ca.cwds.rest.api.domain.Address) PersonAddress(gov.ca.cwds.data.persistence.ns.PersonAddress) PostedPerson(gov.ca.cwds.rest.api.domain.PostedPerson) Response(gov.ca.cwds.rest.api.Response) Person(gov.ca.cwds.rest.api.domain.Person) PostedPerson(gov.ca.cwds.rest.api.domain.PostedPerson) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Response (gov.ca.cwds.rest.api.Response)83 Test (org.junit.Test)80 ReferralClient (gov.ca.cwds.rest.api.domain.cms.ReferralClient)46 CrossReport (gov.ca.cwds.rest.api.domain.cms.CrossReport)45 Allegation (gov.ca.cwds.rest.api.domain.cms.Allegation)44 Client (gov.ca.cwds.rest.api.domain.cms.Client)44 Referral (gov.ca.cwds.rest.api.domain.cms.Referral)44 PostedScreeningToReferral (gov.ca.cwds.rest.api.domain.PostedScreeningToReferral)43 ChildClient (gov.ca.cwds.rest.api.domain.cms.ChildClient)43 CmsReferral (gov.ca.cwds.rest.api.domain.cms.CmsReferral)43 LongText (gov.ca.cwds.rest.api.domain.cms.LongText)43 Reporter (gov.ca.cwds.rest.api.domain.cms.Reporter)43 LinkedHashSet (java.util.LinkedHashSet)43 Set (java.util.Set)43 ScreeningToReferral (gov.ca.cwds.rest.api.domain.ScreeningToReferral)42 Address (gov.ca.cwds.rest.api.domain.cms.Address)42 ClientAddress (gov.ca.cwds.rest.api.domain.cms.ClientAddress)42 ErrorMessage (gov.ca.cwds.rest.api.domain.error.ErrorMessage)22 ExpectedException (org.junit.rules.ExpectedException)16 PostedCmsReferral (gov.ca.cwds.rest.api.domain.cms.PostedCmsReferral)3