Search in sources :

Example 1 with SafetyAlert

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

the class ClientTestUtil method safetyAlert.

public static SafetyAlert safetyAlert(String thirdId, LocalDate activationDate) {
    SafetyAlert safetyAlert = new SafetyAlert();
    safetyAlert.setThirdId(thirdId);
    safetyAlert.setActivationDate(activationDate);
    return safetyAlert;
}
Also used : SafetyAlert(gov.ca.cwds.data.legacy.cms.entity.SafetyAlert)

Example 2 with SafetyAlert

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

the class R09729Test method rule09729_violated_whenSingleAlertBeforeDOB.

@Test
public void rule09729_violated_whenSingleAlertBeforeDOB() throws DroolsException {
    // given
    final Client client = client(SOME_DATE);
    final SafetyAlert safetyAlert = safetyAlert(THIRD_ID, SOME_DATE.minusDays(1));
    final ChildClientEntityAwareDTO input = dto(client, safetyAlert);
    // when + then
    checkRuleViolatedOnce(input, RULE_NAME);
}
Also used : SafetyAlert(gov.ca.cwds.data.legacy.cms.entity.SafetyAlert) Client(gov.ca.cwds.data.legacy.cms.entity.Client) ChildClientEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ChildClientEntityAwareDTO) Test(org.junit.Test)

Example 3 with SafetyAlert

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

the class R09729Test method rule09729_violated_whenOneOfTwoAlertsIsBeforeDOB.

@Test
public void rule09729_violated_whenOneOfTwoAlertsIsBeforeDOB() throws DroolsException {
    // given
    final Client client = client(SOME_DATE);
    final SafetyAlert safetyAlert0 = safetyAlert(THIRD_ID, SOME_DATE.plusDays(100));
    final SafetyAlert safetyAlert1 = safetyAlert(THIRD_ID_2, SOME_DATE.minusDays(100));
    final ChildClientEntityAwareDTO input = dto(client, safetyAlert0, safetyAlert1);
    // when + then
    checkRuleViolatedOnce(input, RULE_NAME);
}
Also used : SafetyAlert(gov.ca.cwds.data.legacy.cms.entity.SafetyAlert) Client(gov.ca.cwds.data.legacy.cms.entity.Client) ChildClientEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ChildClientEntityAwareDTO) Test(org.junit.Test)

Example 4 with SafetyAlert

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

the class R09729Test method rule09729_violatedTwice_whenTwoAlertsBeforeDOB.

@Test
public void rule09729_violatedTwice_whenTwoAlertsBeforeDOB() throws DroolsException {
    // given
    final Client client = client(SOME_DATE);
    final SafetyAlert safetyAlert0 = safetyAlert(THIRD_ID, SOME_DATE.minusDays(1));
    final SafetyAlert safetyAlert1 = safetyAlert(THIRD_ID_2, SOME_DATE.minusDays(100));
    final ChildClientEntityAwareDTO input = dto(client, safetyAlert0, safetyAlert1);
    // when + then
    checkRuleViolated(input, RULE_NAME, 2);
}
Also used : SafetyAlert(gov.ca.cwds.data.legacy.cms.entity.SafetyAlert) Client(gov.ca.cwds.data.legacy.cms.entity.Client) ChildClientEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.ChildClientEntityAwareDTO) Test(org.junit.Test)

Example 5 with SafetyAlert

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

the class SafetyAlertDaoTest method findByClientId_success_whenSingleRecord.

@Test
public void findByClientId_success_whenSingleRecord() {
    executeInTransaction(sessionFactory, (sessionFactory) -> {
        // when
        final Collection<SafetyAlert> actualResults = testSubject.findByClientId("9HNHgeH00E");
        // then
        assertThat(actualResults.size(), is(1));
        final SafetyAlert safetyAlert = actualResults.iterator().next();
        assertThat(safetyAlert.getFkClientId(), is("9HNHgeH00E"));
        assertThat(safetyAlert.getActivationGovernmentEntityType().getPrimaryKey(), is((short) 1126));
        assertThat(safetyAlert.getActivationDate(), is(LocalDate.of(2013, 1, 28)));
        assertThat(safetyAlert.getActivationExplanationText().getIdentifier(), is("7xvG9WT00E"));
        assertThat(safetyAlert.getActivationReasonType().getSystemId(), is((short) 6402));
        assertThat(safetyAlert.getDeactivationGovernmentEntityType(), is(nullValue()));
        assertThat(safetyAlert.getDeactivationDate(), is(nullValue()));
        assertThat(safetyAlert.getDeactivationExplanationText(), is(nullValue()));
    });
}
Also used : SafetyAlert(gov.ca.cwds.data.legacy.cms.entity.SafetyAlert) BaseCwsCmsInMemoryPersistenceTest(gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest) Test(org.junit.Test)

Aggregations

SafetyAlert (gov.ca.cwds.data.legacy.cms.entity.SafetyAlert)8 Test (org.junit.Test)7 ChildClientEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ChildClientEntityAwareDTO)6 Client (gov.ca.cwds.data.legacy.cms.entity.Client)6 BaseCwsCmsInMemoryPersistenceTest (gov.ca.cwds.data.legacy.cms.persistence.BaseCwsCmsInMemoryPersistenceTest)1