use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class ScreeningResourceTest method updateDelegatesToResourceDelegate.
/*
* Update Tests
*/
@Test
public void updateDelegatesToResourceDelegate() throws Exception {
Address address = new Address("", "", "10 main st", "Sacramento", "CA", 95814, "home");
ImmutableList.Builder<Long> builder = ImmutableList.builder();
ScreeningRequest screeningRequest = new ScreeningRequest("X5HNJK", "1973-11-22", "Amador", "1973-11-22", "Home", "email", "First screening", "immediate", "accept_for_investigation", "2016-10-11", "first narrative", address);
inMemoryResource.client().target(FOUND_RESOURCE).request().accept(MediaType.APPLICATION_JSON).put(Entity.entity(screeningRequest, MediaType.APPLICATION_JSON));
verify(resourceDelegate).update(eq(new Long(1)), eq(screeningRequest));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressServiceTest method testCreateExistsError.
@SuppressWarnings("javadoc")
@Test
public void testCreateExistsError() throws Exception {
gov.ca.cwds.data.persistence.ns.Address toCreate = new gov.ca.cwds.data.persistence.ns.Address((long) 1, "742 Evergreen Terrace", "Springfield", "WA", new Integer(98700), "Home");
Address request = new Address(toCreate);
when(addressDao.create(any(gov.ca.cwds.data.persistence.ns.Address.class))).thenReturn(toCreate);
PostedAddress expected = new PostedAddress(1, "", "", "742 Evergreen Terrace", "Springfield", "WA", new Integer(98700), "Home");
PostedAddress returned = addressService.create(request);
// String e = MAPPER.writeValueAsString(expected);
// System.out.println(e);
// String r = MAPPER.writeValueAsString(returned);
// System.out.println(r);
assertThat(returned, is(expected));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressResourceTest method testPostDelegatesToResourceDelegate.
/*
* Create Tests
*/
@SuppressWarnings("javadoc")
@Test
public void testPostDelegatesToResourceDelegate() throws Exception {
Address address = new Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "Home");
inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(address, MediaType.APPLICATION_JSON)).getStatus();
verify(resourceDelegate, atLeastOnce()).create(eq(address));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class ParticipantResourceTest method testPostValidatesEntity.
@Override
@Test
public void testPostValidatesEntity() throws Exception {
roles.add("victim");
Address address = new Address("", "", "123 First St", "San Jose", "CA", 94321, "Home");
addresses.add(address);
Participant participant = new Participant(1, "", "", "Marge", "Simpson", "Female", "11122333", "11-01-2017", 123, 456, roles, addresses);
int status = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(participant, MediaType.APPLICATION_JSON)).getStatus();
assertThat(status, is(422));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class ParticipantResourceTest method testDelete200ResourceSuccess.
@Override
@Test
public void testDelete200ResourceSuccess() throws Exception {
roles.add("victim");
Address address = new Address("", "", "123 First St", "San Jose", "CA", 94321, "Home");
addresses.add(address);
Participant participant = new Participant(1, "", "", "Marge", "Simpson", "Female", "111223333", "2017-01-23", 123, 456, roles, addresses);
int status = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(participant, MediaType.APPLICATION_JSON)).getStatus();
assertThat(status, is(204));
}
Aggregations