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));
}
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));
}
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));
}
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()));
}
Aggregations