use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressResourceTest method testPost200ResourceSuccess.
@SuppressWarnings("javadoc")
@Test
public void testPost200ResourceSuccess() throws Exception {
Address address = new Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "Home");
int status = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(address, MediaType.APPLICATION_JSON)).getStatus();
assertThat(status, is(204));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressResourceTest method testPostValidatesEntity.
@SuppressWarnings("javadoc")
@Test
public void testPostValidatesEntity() throws Exception {
Address address = new Address("", "", "123456789012345678901234567890123456789012345678901", "Springfield", "WA", 98700, "School");
int status = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).post(Entity.entity(address, 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 AddressResourceTest method testUpdate501NotImplemented.
/*
* Update Tests
*/
@SuppressWarnings("javadoc")
@Test
public void testUpdate501NotImplemented() throws Exception {
Address address = new Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "Home");
int status = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).put(Entity.entity(address, MediaType.APPLICATION_JSON)).getStatus();
assertThat(status, is(501));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressServiceTest method testUpdateThrowsNotImplementedException.
@Override
@Test
public void testUpdateThrowsNotImplementedException() throws Exception {
thrown.expect(NotImplementedException.class);
addressService.update(1L, new Address("", "", "street", "city", "state", 95555, "Home"));
}
use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.
the class AddressServiceTest method testCreateReturnsPostedClass.
@Override
@Test
public void testCreateReturnsPostedClass() throws Exception {
gov.ca.cwds.data.persistence.ns.Address toCreate = new gov.ca.cwds.data.persistence.ns.Address(1L, "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 postedAddress = addressService.create(request);
assertThat(postedAddress.getClass(), is(PostedAddress.class));
}
Aggregations