use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testUpdate.
@Override
@Test
public void testUpdate() throws Exception {
String timestamp = "2017-05-23 19:53:50.505";
CountyTriggerEmbeddable countyTriggerEmbeddable = new CountyTriggerEmbeddable(countyOwnershipT, null);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date date = formatter.parse(timestamp);
CountyTrigger countyTrigger = new CountyTrigger(countyOwnershipT, "61", "C", null, "REFR_CLT");
countyTrigger.getPrimaryKey().setIntegratorTimeStamp(date);
CountyTrigger updated = countyTriggerDao.update(countyTrigger);
assertThat(updated, is(countyTrigger));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testUpdateEntityNotFoundException.
@Override
@Test
public void testUpdateEntityNotFoundException() throws Exception {
thrown.expect(EntityNotFoundException.class);
CountyTrigger countyTrigger = new CountyTrigger("ABC1234569", "61", "C", (Date) null, "REFR_CLT");
countyTriggerDao.update(countyTrigger);
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method createClientAddressCountyTriggerTest.
/*
* Test for checking the clientAddress county trigger created with the CL_ADDRT
*/
@SuppressWarnings("javadoc")
@Test
public void createClientAddressCountyTriggerTest() throws JsonParseException, JsonMappingException, IOException {
when(countyTriggerDao.find(any(String.class))).thenReturn(null);
gov.ca.cwds.rest.api.domain.cms.ClientAddress validDomainClientAddress = MAPPER.readValue(fixture("fixtures/legacy/business/rules/laCountyTrigger/validClientAddress.json"), gov.ca.cwds.rest.api.domain.cms.ClientAddress.class);
when(countyTriggerDao.create(any(CountyTrigger.class))).thenAnswer(new Answer<CountyTrigger>() {
@Override
public CountyTrigger answer(InvocationOnMock invocation) throws Throwable {
CountyTrigger report = (CountyTrigger) invocation.getArguments()[0];
countyTrigger = report;
return report;
}
});
ClientAddress clientAddress = new ClientAddress("1234567ABC", validDomainClientAddress, "BTr");
laCountyTrigger.createClientAddressCountyTrigger(clientAddress);
assertThat(countyTrigger.getCountyTriggerEmbeddable().getCountyOwnershipT(), is(equalTo("1234567ABC")));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method createReferralClientCountyTriggerTest.
/*
* Test for checking the referralClient county trigger created with the FKClient_T
*/
@SuppressWarnings("javadoc")
@Test
public void createReferralClientCountyTriggerTest() throws JsonParseException, JsonMappingException, IOException {
when(countyTriggerDao.find(any(String.class))).thenReturn(null);
gov.ca.cwds.rest.api.domain.cms.ReferralClient validDomainReferralClient = MAPPER.readValue(fixture("fixtures/legacy/business/rules/laCountyTrigger/validReferralClient.json"), gov.ca.cwds.rest.api.domain.cms.ReferralClient.class);
when(countyTriggerDao.create(any(CountyTrigger.class))).thenAnswer(new Answer<CountyTrigger>() {
@Override
public CountyTrigger answer(InvocationOnMock invocation) throws Throwable {
CountyTrigger report = (CountyTrigger) invocation.getArguments()[0];
countyTrigger = report;
return report;
}
});
ReferralClient referralClient = new ReferralClient(validDomainReferralClient, "BTr");
laCountyTrigger.createCountyTrigger(referralClient);
assertThat(countyTrigger.getCountyTriggerEmbeddable().getCountyOwnershipT(), is(equalTo("ABC1234567")));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testCreateExistingEntityException.
@Override
@Test
public void testCreateExistingEntityException() throws Exception {
thrown.expect(EntityExistsException.class);
String timestamp = "2017-05-23 19:53:50.597";
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date date = formatter.parse(timestamp);
CountyTrigger countyTrigger = new CountyTrigger("Hzfdiu90X5", "62", "C", null, "REFR_CLT");
countyTrigger.getPrimaryKey().setIntegratorTimeStamp(date);
countyTriggerDao.create(countyTrigger);
}
Aggregations