Search in sources :

Example 16 with ClientRelationship

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

the class R00753Test method noOverlap1.

/**
 * @throws DroolsException
 *     <p>x-------------x
 *                        x-------------x
 */
@Test
public void noOverlap1() throws DroolsException {
    LocalDate localDateStartA = LocalDate.of(2001, 11, 11);
    LocalDate localDateEndA = LocalDate.of(2020, 11, 11);
    ClientRelationship entity = getRelationship(localDateStartA, localDateEndA);
    awareDTO.setEntity(entity);
    List<ClientRelationship> relationships = new ArrayList<>();
    ClientRelationship overlapRelationship1 = getRelationship(localDateEndA.plusDays(1), localDateEndA.plusYears(2));
    relationships.add(overlapRelationship1);
    relationships.add(getRelationship(localDateStartA.minusYears(3), localDateStartA.minusYears(2)));
    relationships.add(getRelationship(localDateEndA.plusYears(3), localDateEndA.plusYears(4)));
    awareDTO.getClientRelationshipList().addAll(relationships);
    checkRuleSatisfied(RULE_NAME);
}
Also used : ArrayList(java.util.ArrayList) ClientRelationship(gov.ca.cwds.data.legacy.cms.entity.ClientRelationship) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 17 with ClientRelationship

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

the class R00753Test method overlap6.

/**
 * @throws DroolsException
 *     x-------------x
 *                      x-------x
 */
@Test
public void overlap6() throws DroolsException {
    LocalDate localDateStartA = LocalDate.of(2001, 11, 11);
    LocalDate localDateEndA = LocalDate.of(2020, 11, 11);
    ClientRelationship entity = getRelationship(localDateStartA, localDateEndA);
    awareDTO.setEntity(entity);
    List<ClientRelationship> relationships = new ArrayList<>();
    ClientRelationship overlapRelationship1 = getRelationship(localDateEndA, localDateEndA.plusYears(2));
    relationships.add(overlapRelationship1);
    relationships.add(getRelationship(localDateStartA.minusYears(3), localDateStartA.minusYears(2)));
    relationships.add(getRelationship(localDateEndA.plusYears(3), localDateEndA.plusYears(4)));
    awareDTO.getClientRelationshipList().addAll(relationships);
    checkRuleViolatedOnce(RULE_NAME);
}
Also used : ArrayList(java.util.ArrayList) ClientRelationship(gov.ca.cwds.data.legacy.cms.entity.ClientRelationship) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 18 with ClientRelationship

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

the class R00756Test method getClientRelationship.

private ClientRelationship getClientRelationship(LocalDate startDate, LocalDate endDate) {
    ClientRelationship entity = new ClientRelationship();
    entity.setStartDate(startDate);
    entity.setEndDate(endDate);
    return entity;
}
Also used : ClientRelationship(gov.ca.cwds.data.legacy.cms.entity.ClientRelationship)

Example 19 with ClientRelationship

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

the class R00756Test method clientRelationship.

private static ClientRelationship clientRelationship(String id, Client primaryClient, Client secondaryClient, LocalDate startDate) {
    ClientRelationship relationship = new ClientRelationship();
    relationship.setIdentifier(id);
    relationship.setPrimaryClient(primaryClient);
    relationship.setSecondaryClient(secondaryClient);
    relationship.setStartDate(startDate);
    return relationship;
}
Also used : ClientRelationship(gov.ca.cwds.data.legacy.cms.entity.ClientRelationship)

Aggregations

ClientRelationship (gov.ca.cwds.data.legacy.cms.entity.ClientRelationship)19 Test (org.junit.Test)15 LocalDate (java.time.LocalDate)13 ArrayList (java.util.ArrayList)8 Client (gov.ca.cwds.data.legacy.cms.entity.Client)1 YesNoUnknown (gov.ca.cwds.data.legacy.cms.entity.enums.YesNoUnknown)1 ClientRelationshipType (gov.ca.cwds.data.legacy.cms.entity.syscodes.ClientRelationshipType)1 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 TestCase.assertTrue (junit.framework.TestCase.assertTrue)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Before (org.junit.Before)1