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);
}
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()));
}
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));
}
Aggregations