Search in sources :

Example 1 with Address

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));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 2 with Address

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));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 3 with Address

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));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 4 with Address

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"));
}
Also used : PostedAddress(gov.ca.cwds.rest.api.domain.PostedAddress) Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 5 with Address

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));
}
Also used : PostedAddress(gov.ca.cwds.rest.api.domain.PostedAddress) Address(gov.ca.cwds.rest.api.domain.Address) PostedAddress(gov.ca.cwds.rest.api.domain.PostedAddress) Test(org.junit.Test)

Aggregations

Address (gov.ca.cwds.rest.api.domain.Address)21 Test (org.junit.Test)19 PostedAddress (gov.ca.cwds.rest.api.domain.PostedAddress)7 PersonAddress (gov.ca.cwds.data.persistence.ns.PersonAddress)3 Participant (gov.ca.cwds.rest.api.domain.Participant)3 Ethnicity (gov.ca.cwds.rest.api.domain.Ethnicity)2 Language (gov.ca.cwds.rest.api.domain.Language)2 Person (gov.ca.cwds.rest.api.domain.Person)2 PhoneNumber (gov.ca.cwds.rest.api.domain.PhoneNumber)2 PostedPerson (gov.ca.cwds.rest.api.domain.PostedPerson)2 Race (gov.ca.cwds.rest.api.domain.Race)2 HashSet (java.util.HashSet)2 ImmutableList (com.google.common.collect.ImmutableList)1 PersonEthnicity (gov.ca.cwds.data.persistence.ns.PersonEthnicity)1 PersonLanguage (gov.ca.cwds.data.persistence.ns.PersonLanguage)1 PersonPhone (gov.ca.cwds.data.persistence.ns.PersonPhone)1 PersonRace (gov.ca.cwds.data.persistence.ns.PersonRace)1 ScreeningRequest (gov.ca.cwds.rest.api.domain.ScreeningRequest)1