use of gov.ca.cwds.rest.api.domain.cms.Client in project API by ca-cwds.
the class ClientServiceTest method testUpdateReturnsCorrectEntity.
@Override
@Test
public void testUpdateReturnsCorrectEntity() throws Exception {
String id = "Aaeae9r0F4";
Client expected = MAPPER.readValue(fixture("fixtures/domain/legacy/Client/valid/serviceValid.json"), Client.class);
gov.ca.cwds.data.persistence.cms.Client client = new gov.ca.cwds.data.persistence.cms.Client(id, expected, "ABC");
when(clientDao.find("ABC1234567")).thenReturn(client);
when(clientDao.update(any())).thenReturn(client);
Object retval = clientService.update("ABC1234567", expected);
assertThat(retval.getClass(), is(Client.class));
}
use of gov.ca.cwds.rest.api.domain.cms.Client in project API by ca-cwds.
the class ClientServiceTest method testCreateReturnsPostedClass.
// create test
@Override
@Test
public void testCreateReturnsPostedClass() throws Exception {
String id = "Aaeae9r0F4";
Client clientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/Client/valid/serviceValid.json"), Client.class);
gov.ca.cwds.data.persistence.cms.Client toCreate = new gov.ca.cwds.data.persistence.cms.Client(id, clientDomain, "q1p");
Client request = new Client(toCreate, false);
when(clientDao.create(any(gov.ca.cwds.data.persistence.cms.Client.class))).thenReturn(toCreate);
Response response = clientService.create(request);
assertThat(response.getClass(), is(PostedClient.class));
}
use of gov.ca.cwds.rest.api.domain.cms.Client in project API by ca-cwds.
the class ClientServiceTest method testCreateNullIDError.
@Override
@Test
public void testCreateNullIDError() throws Exception {
try {
Client clientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/Client/valid/serviceValid.json"), Client.class);
gov.ca.cwds.data.persistence.cms.Client toCreate = new gov.ca.cwds.data.persistence.cms.Client(null, clientDomain, "ABC");
when(clientDao.create(any(gov.ca.cwds.data.persistence.cms.Client.class))).thenReturn(toCreate);
} catch (ServiceException e) {
assertEquals("Client ID cannot be empty", e.getMessage());
}
}
use of gov.ca.cwds.rest.api.domain.cms.Client in project API by ca-cwds.
the class ClientServiceTest method testCreateReturnsNonNull.
@SuppressWarnings("javadoc")
@Test
public void testCreateReturnsNonNull() throws Exception {
String id = "Aaeae9r0F4";
Client clientDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/Client/valid/serviceValid.json"), Client.class);
gov.ca.cwds.data.persistence.cms.Client toCreate = new gov.ca.cwds.data.persistence.cms.Client(id, clientDomain, "q1p");
Client request = new Client(toCreate, false);
when(clientDao.create(any(gov.ca.cwds.data.persistence.cms.Client.class))).thenReturn(toCreate);
PostedClient postedClient = clientService.create(request);
assertThat(postedClient, is(notNullValue()));
}
use of gov.ca.cwds.rest.api.domain.cms.Client in project API by ca-cwds.
the class ClientServiceTest method testFindReturnsCorrectEntity.
@Override
@Test
public void testFindReturnsCorrectEntity() throws Exception {
String id = "AaiU7IW0Rt";
Client expected = MAPPER.readValue(fixture("fixtures/domain/legacy/Client/valid/serviceValid.json"), Client.class);
gov.ca.cwds.data.persistence.cms.Client client = new gov.ca.cwds.data.persistence.cms.Client(id, expected, "04Z");
when(clientDao.find(id)).thenReturn(client);
Client found = clientService.find(id);
assertThat(found, is(expected));
}
Aggregations