Search in sources :

Example 6 with PhoneNumber

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

the class PhoneNumberServiceTest method testCreateReturnsCorrectEntity.

@Test
@Override
public void testCreateReturnsCorrectEntity() throws Exception {
    gov.ca.cwds.data.persistence.ns.PhoneNumber toCreate = new gov.ca.cwds.data.persistence.ns.PhoneNumber(10L, "408 987-6543", "Home");
    PhoneNumber request = new PhoneNumber(toCreate);
    when(phoneNumberDao.create(any(gov.ca.cwds.data.persistence.ns.PhoneNumber.class))).thenReturn(toCreate);
    PostedPhoneNumber expected = new PostedPhoneNumber(10, "408 987-6543", "Home");
    PostedPhoneNumber returned = phoneNumberService.create(request);
    assertThat(returned, is(expected));
}
Also used : PostedPhoneNumber(gov.ca.cwds.rest.api.domain.PostedPhoneNumber) PhoneNumber(gov.ca.cwds.rest.api.domain.PhoneNumber) PostedPhoneNumber(gov.ca.cwds.rest.api.domain.PostedPhoneNumber) Test(org.junit.Test)

Example 7 with PhoneNumber

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

the class PhoneNumberServiceTest method testCreateExistsError.

@SuppressWarnings("javadoc")
@Test
public void testCreateExistsError() throws Exception {
    gov.ca.cwds.data.persistence.ns.PhoneNumber toCreate = new gov.ca.cwds.data.persistence.ns.PhoneNumber((long) 1, "408 987-6543", "Home");
    PhoneNumber request = new PhoneNumber(toCreate);
    when(phoneNumberDao.create(any(gov.ca.cwds.data.persistence.ns.PhoneNumber.class))).thenReturn(toCreate);
    PostedPhoneNumber expected = new PostedPhoneNumber(1, "408 987-6543", "Home");
    PostedPhoneNumber returned = phoneNumberService.create(request);
    assertThat(returned, is(expected));
}
Also used : PostedPhoneNumber(gov.ca.cwds.rest.api.domain.PostedPhoneNumber) PhoneNumber(gov.ca.cwds.rest.api.domain.PhoneNumber) PostedPhoneNumber(gov.ca.cwds.rest.api.domain.PostedPhoneNumber) Test(org.junit.Test)

Example 8 with PhoneNumber

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

the class PhoneNumberServiceTest method testFindReturnsCorrectEntity.

@Test
@Override
public void testFindReturnsCorrectEntity() throws Exception {
    when(phoneNumberDao.find(new Long(1))).thenReturn(new gov.ca.cwds.data.persistence.ns.PhoneNumber(1L, "408 987-6543", "Home"));
    PhoneNumber expected = new PhoneNumber("408 987-6543", "Home");
    PhoneNumber found = phoneNumberService.find(new Long(1));
    assertThat(found, is(expected));
}
Also used : PhoneNumber(gov.ca.cwds.rest.api.domain.PhoneNumber) PostedPhoneNumber(gov.ca.cwds.rest.api.domain.PostedPhoneNumber) Test(org.junit.Test)

Example 9 with PhoneNumber

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

the class PhoneNumberServiceTest method testFindReturnsNullWhenNotFound.

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

Aggregations

PhoneNumber (gov.ca.cwds.rest.api.domain.PhoneNumber)9 PostedPhoneNumber (gov.ca.cwds.rest.api.domain.PostedPhoneNumber)7 Test (org.junit.Test)7 PersonAddress (gov.ca.cwds.data.persistence.ns.PersonAddress)2 Address (gov.ca.cwds.rest.api.domain.Address)2 Ethnicity (gov.ca.cwds.rest.api.domain.Ethnicity)2 Language (gov.ca.cwds.rest.api.domain.Language)2 Race (gov.ca.cwds.rest.api.domain.Race)2 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 Person (gov.ca.cwds.rest.api.domain.Person)1 PostedPerson (gov.ca.cwds.rest.api.domain.PostedPerson)1 HashSet (java.util.HashSet)1