use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method createReferralCountyTriggerTest.
/*
* Test for checking the referral county trigger created with the FKAddress_T
*/
@SuppressWarnings("javadoc")
@Test
public void createReferralCountyTriggerTest() throws JsonParseException, JsonMappingException, IOException {
when(countyTriggerDao.find(any(String.class))).thenReturn(null);
gov.ca.cwds.rest.api.domain.cms.Referral validDomainReferral = MAPPER.readValue(fixture("fixtures/legacy/business/rules/laCountyTrigger/validReferral.json"), gov.ca.cwds.rest.api.domain.cms.Referral.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;
}
});
Referral referral = new Referral("ABC1234567", validDomainReferral, "BTr");
laCountyTrigger.createCountyTrigger(referral);
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 clientAddressfkAddressIdNullTest.
/*
* Test for checking clientAddress county trigger not created as FkAddress_T is null
*/
@SuppressWarnings("javadoc")
@Test
public void clientAddressfkAddressIdNullTest() 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/fkAddressTNull.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("ABC1234567", validDomainClientAddress, "BTr");
laCountyTrigger.createClientAddressCountyTrigger(clientAddress);
assertThat(countyTrigger, is(equalTo(null)));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method referralClientFkClientIdNullTest.
/*
* Test for checking referralClient county trigger not created as FkClient_T is null
*/
@SuppressWarnings("javadoc")
@Test
public void referralClientFkClientIdNullTest() 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/referralClientFkClientTIdNull.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, is(equalTo(null)));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method clientAddressfkclientIdNullTest.
/*
* Test for checking clientAddress county trigger not created as FkClient_T is null
*/
@SuppressWarnings("javadoc")
@Test
public void clientAddressfkclientIdNullTest() 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/fkClientTNull.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("ABC1234567", validDomainClientAddress, "BTr");
laCountyTrigger.createClientAddressCountyTrigger(clientAddress);
assertThat(countyTrigger, is(equalTo(null)));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTriggerTest method referralFkAddresssIdNullTest.
/*
* Test for checking referral county trigger not created as FkAddress_T is null
*/
@SuppressWarnings("javadoc")
@Test
public void referralFkAddresssIdNullTest() throws JsonParseException, JsonMappingException, IOException {
when(countyTriggerDao.find(any(String.class))).thenReturn(null);
gov.ca.cwds.rest.api.domain.cms.Referral validDomainReferral = MAPPER.readValue(fixture("fixtures/legacy/business/rules/laCountyTrigger/allegesAbuseOccurredAtAddressIdNull.json"), gov.ca.cwds.rest.api.domain.cms.Referral.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;
}
});
Referral referral = new Referral("ABC1234567", validDomainReferral, "BTr");
laCountyTrigger.createCountyTrigger(referral);
assertThat(countyTrigger, is(equalTo(null)));
}
Aggregations