use of gov.ca.cwds.data.persistence.cms.CountyOwnership in project API by ca-cwds.
the class NonLACountyTriggersTest method testChecksReferralClientCreatedCountyOwnership.
/*
* Test for checking the referral Client CountyOnwership created or updated through the PUT method
*/
@SuppressWarnings("javadoc")
@Test
public void testChecksReferralClientCreatedCountyOwnership() throws Exception {
ReferralClient referralClientDomain = MAPPER.readValue(fixture("fixtures/legacy/business/rules/nonLaCountyTrigger/referralClientValid.json"), ReferralClient.class);
gov.ca.cwds.data.persistence.cms.ReferralClient toCreate = new gov.ca.cwds.data.persistence.cms.ReferralClient(referralClientDomain, "ABC");
ReferralClient request = new ReferralClient(toCreate);
when(countyOwnershipDao.find(any(String.class))).thenReturn(null);
when(countyOwnershipDao.create(any(CountyOwnership.class))).thenAnswer(new Answer<CountyOwnership>() {
@Override
public CountyOwnership answer(InvocationOnMock invocation) throws Throwable {
CountyOwnership report = (CountyOwnership) invocation.getArguments()[0];
countyOwnership = report;
return report;
}
});
nonLaCountyTriggers.createAndUpdateReferralClientCoutyOwnership(toCreate);
Assert.assertNotNull(countyOwnership);
assertThat(countyOwnership.getEntityCode(), is(equalTo("C")));
}
use of gov.ca.cwds.data.persistence.cms.CountyOwnership in project API by ca-cwds.
the class NonLACountyTriggersTest method testForReferralClientUpdatedCountyOwnership.
/*
* Test for checking the referral Client CountyOnwership updated
*/
@SuppressWarnings("javadoc")
@Test
public void testForReferralClientUpdatedCountyOwnership() throws Exception {
ReferralClient referralClientDomain = MAPPER.readValue(fixture("fixtures/legacy/business/rules/nonLaCountyTrigger/referralClientValid.json"), ReferralClient.class);
gov.ca.cwds.data.persistence.cms.ReferralClient toCreate = new gov.ca.cwds.data.persistence.cms.ReferralClient(referralClientDomain, "ABC");
ReferralClient request = new ReferralClient(toCreate);
when(countyOwnershipDao.find(any(String.class))).thenReturn(new CountyOwnership());
when(countyOwnershipDao.update(any(CountyOwnership.class))).thenAnswer(new Answer<CountyOwnership>() {
@Override
public CountyOwnership answer(InvocationOnMock invocation) throws Throwable {
CountyOwnership report = (CountyOwnership) invocation.getArguments()[0];
countyOwnership = report;
return report;
}
});
nonLaCountyTriggers.createAndUpdateReferralClientCoutyOwnership(toCreate);
Assert.assertNotNull(countyOwnership);
assertThat(countyOwnership.getCounty62Flag(), is(equalTo("Y")));
}
use of gov.ca.cwds.data.persistence.cms.CountyOwnership in project API by ca-cwds.
the class NonLACountyTriggersTest method testForClientCreatedCountyOwnershipTest.
/*
* Test for checking the Client CountyOnwership created
*/
@SuppressWarnings("javadoc")
@Test
public void testForClientCreatedCountyOwnershipTest() throws Exception {
gov.ca.cwds.rest.api.domain.cms.Client ClientDomain = MAPPER.readValue(fixture("fixtures/legacy/business/rules/nonLaCountyTrigger/clientValid.json"), gov.ca.cwds.rest.api.domain.cms.Client.class);
Client toCreate = new Client("ABC1234567", ClientDomain, "ABC");
when(countyOwnershipDao.create(any(CountyOwnership.class))).thenAnswer(new Answer<CountyOwnership>() {
@Override
public CountyOwnership answer(InvocationOnMock invocation) throws Throwable {
CountyOwnership report = (CountyOwnership) invocation.getArguments()[0];
countyOwnership = report;
return report;
}
});
nonLaCountyTriggers.createClientCountyTrigger(toCreate);
Assert.assertNotNull(countyOwnership);
assertThat(countyOwnership.getEntityCode(), is(equalTo("C")));
}
use of gov.ca.cwds.data.persistence.cms.CountyOwnership in project API by ca-cwds.
the class CountyOwnershipDaoIT method testDeleteEntityNotFoundException.
@Override
@Test
public void testDeleteEntityNotFoundException() throws Exception {
String id = "ABC1234568";
CountyOwnership deleted = countyOwnershipDao.delete(id);
assertThat(deleted, is(nullValue()));
}
use of gov.ca.cwds.data.persistence.cms.CountyOwnership in project API by ca-cwds.
the class CountyOwnershipDaoIT method testCreateExistingEntityException.
@Override
@Test
public void testCreateExistingEntityException() throws Exception {
thrown.expect(EntityExistsException.class);
CountyOwnership countyOwnership = new CountyOwnership("AaQshqm0Mb", "C", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", null);
countyOwnershipDao.create(countyOwnership);
}
Aggregations