Search in sources :

Example 6 with Address

use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.

the class AddressServiceTest method testFindReturnsCorrectEntity.

@Override
@Test
public void testFindReturnsCorrectEntity() throws Exception {
    when(addressDao.find(new Long(1))).thenReturn(new gov.ca.cwds.data.persistence.ns.Address(1L, "742 Evergreen Terrace", "Springfield", "WA", new Integer(98700), "Home"));
    Address expected = new Address("", "", "742 Evergreen Terrace", "Springfield", "WA", 98700, "Home");
    Address found = addressService.find(new Long(1));
    assertThat(found, is(expected));
}
Also used : PostedAddress(gov.ca.cwds.rest.api.domain.PostedAddress) Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 7 with Address

use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.

the class AddressServiceTest method testCreateReturnsCorrectEntity.

@Override
@Test
public void testCreateReturnsCorrectEntity() throws Exception {
    gov.ca.cwds.data.persistence.ns.Address toCreate = new gov.ca.cwds.data.persistence.ns.Address(10L, "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(10, "", "", "742 Evergreen Terrace", "Springfield", "WA", new Integer(98700), "Home");
    PostedAddress returned = addressService.create(request);
    assertThat(returned, is(expected));
}
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)

Example 8 with Address

use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.

the class AddressServiceTest method testFindReturnsNullWhenNotFound.

@Override
@Test
public void testFindReturnsNullWhenNotFound() throws Exception {
    when(addressDao.find(new Long(-1))).thenReturn(null);
    Address found = addressService.find(new Long(-1));
    assertThat(found, is(nullValue()));
}
Also used : PostedAddress(gov.ca.cwds.rest.api.domain.PostedAddress) Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 9 with Address

use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.

the class AddressValidationServiceTest method testfetchValidatedAddressesThrowsExceptionWhenSmartyStreetsConfigurationNotProvided.

@Test
public void testfetchValidatedAddressesThrowsExceptionWhenSmartyStreetsConfigurationNotProvided() throws Exception {
    thrown.expect(Exception.class);
    addressValidationService.fetchValidatedAddresses(new Address("", "", "street", "city", "state", 95555, "Home"));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) Test(org.junit.Test)

Example 10 with Address

use of gov.ca.cwds.rest.api.domain.Address in project API by ca-cwds.

the class AddressValidationServiceTest method updateThrowsNotImplementedException.

/*
   * update tests
   */
@Test
public void updateThrowsNotImplementedException() throws Exception {
    thrown.expect(NotImplementedException.class);
    addressValidationService.update(1L, new Address("", "", "street", "city", "state", 95555, "Home"));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) 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