use of gov.ca.cwds.rest.api.domain.cms.ClientUc in project API by ca-cwds.
the class ClientUcServiceTest method testUpdateThrowsExceptionWhenNotFound.
@SuppressWarnings("javadoc")
@Test
public void testUpdateThrowsExceptionWhenNotFound() throws Exception {
try {
ClientUc clientUcRquest = MAPPER.readValue(fixture("fixtures/domain/legacy/ClientUc/valid/valid.json"), ClientUc.class);
when(clientUcDao.update(any())).thenThrow(EntityNotFoundException.class);
clientUcService.update("ZZZZZZZZZZ", clientUcRquest);
} catch (Exception e) {
assertEquals(e.getClass(), ServiceException.class);
}
}
use of gov.ca.cwds.rest.api.domain.cms.ClientUc in project API by ca-cwds.
the class ClientUcServiceTest method testFindReturnsCorrectEntity.
@Override
@Test
public void testFindReturnsCorrectEntity() throws Exception {
String id = "KFXgqgo0JG";
ClientUc expected = MAPPER.readValue(fixture("fixtures/domain/legacy/ClientUc/valid/valid.json"), ClientUc.class);
gov.ca.cwds.data.persistence.cms.ClientUc clientUc = new gov.ca.cwds.data.persistence.cms.ClientUc(expected, "q27");
when(clientUcDao.find(id)).thenReturn(clientUc);
ClientUc found = clientUcService.find(id);
assertThat(found, is(expected));
}
use of gov.ca.cwds.rest.api.domain.cms.ClientUc in project API by ca-cwds.
the class ClientUcServiceTest method testUpdateReturnsCorrectEntity.
@Override
@Test
public void testUpdateReturnsCorrectEntity() throws Exception {
String id = "AaoDyiJq27";
ClientUc expected = MAPPER.readValue(fixture("fixtures/domain/legacy/ClientUc/valid/valid.json"), ClientUc.class);
gov.ca.cwds.data.persistence.cms.ClientUc clientUc = new gov.ca.cwds.data.persistence.cms.ClientUc(expected, "q27");
when(clientUcDao.find("ABC1234567")).thenReturn(clientUc);
when(clientUcDao.update(any())).thenReturn(clientUc);
Object retval = clientUcService.update("ABC1234567", expected);
assertThat(retval.getClass(), is(ClientUc.class));
}
use of gov.ca.cwds.rest.api.domain.cms.ClientUc in project API by ca-cwds.
the class ClientUcServiceTest method testCreateBlankIDError.
@Override
@Test
public void testCreateBlankIDError() throws Exception {
try {
ClientUc clientUcDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/ClientUc/valid/valid.json"), ClientUc.class);
gov.ca.cwds.data.persistence.cms.ClientUc toCreate = new gov.ca.cwds.data.persistence.cms.ClientUc(clientUcDomain, "q27");
when(clientUcDao.create(any(gov.ca.cwds.data.persistence.cms.ClientUc.class))).thenReturn(toCreate);
ClientUc expected = new ClientUc(toCreate);
} catch (ServiceException e) {
assertEquals("LongText ID cannot be blank", e.getMessage());
}
}
use of gov.ca.cwds.rest.api.domain.cms.ClientUc in project API by ca-cwds.
the class ClientUcServiceTest method testCreateNullIDError.
@Override
@Test
public void testCreateNullIDError() throws Exception {
try {
ClientUc clientUcDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/ClientUc/valid/valid.json"), ClientUc.class);
gov.ca.cwds.data.persistence.cms.ClientUc toCreate = new gov.ca.cwds.data.persistence.cms.ClientUc(clientUcDomain, "q27");
when(clientUcDao.create(any(gov.ca.cwds.data.persistence.cms.ClientUc.class))).thenReturn(toCreate);
ClientUc expected = new ClientUc(toCreate);
} catch (ServiceException e) {
assertEquals("Client ID cannot be blank", e.getMessage());
}
}
Aggregations