use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class ScreeningServiceTest method updateReturnsScreeningResponseOnSuccess.
@Test
public void updateReturnsScreeningResponseOnSuccess() throws Exception {
gov.ca.cwds.rest.api.domain.Address domainAddress = new gov.ca.cwds.rest.api.domain.Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "home");
ScreeningRequest screeningRequest = new ScreeningRequest("ref", "2016-10-31", "Sac", "2016-10-31", "loc", "comm", "name", "now", "sure", "2016-10-31", "narrative", domainAddress);
gov.ca.cwds.data.persistence.ns.Screening screening = new gov.ca.cwds.data.persistence.ns.Screening(1L, screeningRequest, new Address(domainAddress, null, null), null, null, null);
when(screeningDao.find(new Long(123))).thenReturn(screening);
when(screeningDao.update(any())).thenReturn(screening);
Object retval = screeningService.update(1L, screeningRequest);
assertThat(retval.getClass(), is(ScreeningResponse.class));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class ScreeningServiceTest method updateReturnsCorrectScreeningResponseOnSuccess.
@Test
public void updateReturnsCorrectScreeningResponseOnSuccess() throws Exception {
roles.add("victim");
gov.ca.cwds.rest.api.domain.Address domainAddress = new gov.ca.cwds.rest.api.domain.Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "home");
addresses.add(domainAddress);
ScreeningRequest screeningRequest = new ScreeningRequest("ref", "2016-10-31", "Sac", "2016-10-31", "loc", "comm", "name", "now", "sure", "2016-10-31", "narrative", domainAddress);
Participant bart = new Participant(1, "", "", "Bart", "Simpson", "male", "123456789", "2016-10-31", 1234, 1234, roles, addresses);
Participant maggie = new Participant(2, "", "", "Maggie", "Simpson", "female", "123456789", "2016-10-31", 1234, 1234, roles, addresses);
// Participant bart = new Participant(1, 123, "Bart", "Simpson", "M", "2016-10-31",
// "123456789");
// Participant maggie = new Participant(2, 1, "Maggie", "Simpson", "M", "2016-10-31",
// "123456789");
ImmutableSet.Builder<gov.ca.cwds.data.persistence.ns.Participant> peopleListBuilder = ImmutableSet.builder();
ImmutableSet<gov.ca.cwds.data.persistence.ns.Participant> people = peopleListBuilder.add(new gov.ca.cwds.data.persistence.ns.Participant(bart, null, null)).add(new gov.ca.cwds.data.persistence.ns.Participant(maggie, null, null)).build();
gov.ca.cwds.data.persistence.ns.Screening screening = new gov.ca.cwds.data.persistence.ns.Screening(1L, screeningRequest, new Address(domainAddress, null, null), people, null, null);
when(screeningDao.find(new Long(123))).thenReturn(screening);
when(screeningDao.update(any())).thenReturn(screening);
ScreeningResponse expected = new ScreeningResponse(screening, people);
ScreeningResponse updated = screeningService.update(1L, screeningRequest);
assertThat(updated, is(expected));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testUpdateEntityNotFoundException.
@Override
@Test
public void testUpdateEntityNotFoundException() {
thrown.expect(EntityNotFoundException.class);
Address address = new Address(111L, "123 Main Street", "SAC", "CA", 95757, "Home");
addressDao.update(address);
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testFindEntityNotFoundException.
@Override
@Test
public void testFindEntityNotFoundException() throws Exception {
long id = 99;
Address found = addressDao.find(id);
assertThat(found, is(nullValue()));
}
use of gov.ca.cwds.data.persistence.ns.Address in project API by ca-cwds.
the class AddressDaoIT method testCreateExistingEntityException.
@Override
@Test
public void testCreateExistingEntityException() {
thrown.expect(EntityExistsException.class);
Address address = new Address(1L, "123 Main Street", "SAC", "CA", 95757, "Home");
addressDao.create(address);
}
Aggregations