Search in sources :

Example 1 with FCEligibility

use of gov.ca.cwds.data.legacy.cms.entity.FCEligibility in project api-core by ca-cwds.

the class R11126Test method testInValidListOfEligibilities.

@Test
public void testInValidListOfEligibilities() throws Exception {
    ChildClient client = createClient(CLIENT_BIRTH_DAY);
    clientEntityAwareDTO.setEntity(client);
    List<FCEligibility> fcEligibilities = createListOfInvalidChildClientEligibilities();
    clientEntityAwareDTO.getFcEligibilities().addAll(fcEligibilities);
    checkRuleViolatedOnce(RULE_NAME);
}
Also used : FCEligibility(gov.ca.cwds.data.legacy.cms.entity.FCEligibility) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) Test(org.junit.Test)

Example 2 with FCEligibility

use of gov.ca.cwds.data.legacy.cms.entity.FCEligibility in project api-core by ca-cwds.

the class R11126Test method createListOfInvalidChildClientEligibilities.

private static List<FCEligibility> createListOfInvalidChildClientEligibilities() {
    FCEligibility eligibility1 = createFcEligibility(CLIENT_ID, CLIENT_BIRTH_DAY.minusDays(1));
    FCEligibility eligibility2 = createFcEligibility(CLIENT_ID, CLIENT_BIRTH_DAY.minusMonths(1));
    FCEligibility eligibility3 = createFcEligibility(CLIENT_ID, CLIENT_BIRTH_DAY.minusYears(1));
    return Arrays.asList(eligibility1, eligibility2, eligibility3);
}
Also used : FCEligibility(gov.ca.cwds.data.legacy.cms.entity.FCEligibility)

Example 3 with FCEligibility

use of gov.ca.cwds.data.legacy.cms.entity.FCEligibility in project api-core by ca-cwds.

the class FCEligibilityDaoTest method testFindByWrongChildClientId.

@Test
public void testFindByWrongChildClientId() throws Exception {
    cleanAllAndInsert("/dbunit/Client/update/FCEligibility.xml");
    executeInTransaction(sessionFactory, sessionFactory1 -> {
        ChildClient childClient = (ChildClient) clientDao.find(WRONG_CHILD_CLIENT_ID);
        assertNull(childClient);
    });
    executeInTransaction(sessionFactory, sessionFactory1 -> {
        List<FCEligibility> fcEligibilities = fcEligibilityDao.findByChildClientId(WRONG_CHILD_CLIENT_ID);
        assertNotNull(fcEligibilities);
        assertEquals(0, fcEligibilities.size());
    });
}
Also used : FCEligibility(gov.ca.cwds.data.legacy.cms.entity.FCEligibility) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Example 4 with FCEligibility

use of gov.ca.cwds.data.legacy.cms.entity.FCEligibility in project api-core by ca-cwds.

the class FCEligibilityDaoTest method testFindByChildClientId.

@Test
public void testFindByChildClientId() throws Exception {
    cleanAllAndInsert("/dbunit/Client/update/FCEligibility.xml");
    executeInTransaction(sessionFactory, sessionFactory1 -> {
        ChildClient childClient = (ChildClient) clientDao.find(CHILD_CLIENT_ID);
        assertNotNull(childClient);
        assertEquals(true, childClient.getAfdcFcEligibilityIndicatorVar());
        assertEquals(CHILD_CLIENT_ID, childClient.getVictimClientId());
    });
    executeInTransaction(sessionFactory, sessionFactory1 -> {
        List<FCEligibility> fcEligibilities = fcEligibilityDao.findByChildClientId(CHILD_CLIENT_ID);
        assertNotNull(fcEligibilities);
        assertEquals(1, fcEligibilities.size());
        assertEquals(CHILD_CLIENT_ID, fcEligibilities.get(0).getChildClientId());
    });
}
Also used : FCEligibility(gov.ca.cwds.data.legacy.cms.entity.FCEligibility) ChildClient(gov.ca.cwds.data.legacy.cms.entity.ChildClient) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Example 5 with FCEligibility

use of gov.ca.cwds.data.legacy.cms.entity.FCEligibility in project api-core by ca-cwds.

the class R11126Test method createFcEligibility.

private static FCEligibility createFcEligibility(String childClientId, LocalDate date) {
    FCEligibility eligibility = new FCEligibility();
    eligibility.setChildClientId(childClientId);
    eligibility.setDate(date);
    return eligibility;
}
Also used : FCEligibility(gov.ca.cwds.data.legacy.cms.entity.FCEligibility)

Aggregations

FCEligibility (gov.ca.cwds.data.legacy.cms.entity.FCEligibility)7 ChildClient (gov.ca.cwds.data.legacy.cms.entity.ChildClient)3 Test (org.junit.Test)3 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)2 ImmutableList (com.google.common.collect.ImmutableList)1 Session (org.hibernate.Session)1