Search in sources :

Example 1 with PlacementHome

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

the class PlacementHomeCreateAuthorizerTest method checkResourceMgmtAuthorized.

@Test
public void checkResourceMgmtAuthorized() {
    // given
    final PerryAccount perryAccount = initPerryAccountWithPrivileges("Resource Mgmt Placement Facility Maint");
    perryAccount.setCountyCwsCode("1126");
    perryAccount.setCountyCode("99");
    perryAccount.setCountyName("State of California");
    mockStatic(PerrySubject.class);
    when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
    final PlacementHome placementHome = initPlacementHome();
    // when
    final boolean actual = testSubject.checkInstance(placementHome);
    // then
    assertThat(actual, is(true));
}
Also used : PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with PlacementHome

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

the class PlacementHomeCreateAuthorizerTest method checkCWSCaseManagementUnauthorized.

@Test
public void checkCWSCaseManagementUnauthorized() {
    // given
    final PerryAccount perryAccount = initPerryAccountWithPrivileges("CWS Case Management System");
    perryAccount.setCountyCwsCode("1068");
    perryAccount.setCountyCode("01");
    perryAccount.setCountyName("Alameda");
    mockStatic(PerrySubject.class);
    when(PerrySubject.getPerryAccount()).thenReturn(perryAccount);
    final PlacementHome placementHome = initPlacementHome();
    // when
    final boolean actual = testSubject.checkInstance(placementHome);
    // then
    assertThat(actual, is(false));
}
Also used : PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with PlacementHome

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

the class R03855Test method testMaxAgeInvalid.

@Test
public void testMaxAgeInvalid() throws Exception {
    PlacementHome placementHome = new PlacementHome();
    placementHome.setAgeToNo((short) 27);
    try {
        runBusinessValidation(placementHome);
        fail();
    } catch (BusinessValidationException e) {
        assert e.getValidationDetailsList().stream().anyMatch(issueDetails -> issueDetails.getCode().equals("R-03855"));
    }
}
Also used : DroolsException(gov.ca.cwds.drools.DroolsException) PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) PlacementHomeDroolsConfiguration(gov.ca.cwds.cms.data.access.service.rules.PlacementHomeDroolsConfiguration) BaseDocToolRulesPlacementHomeTest(gov.ca.cwds.cms.data.access.service.impl.placementHome.BaseDocToolRulesPlacementHomeTest) BusinessValidationException(gov.ca.cwds.rest.exception.BusinessValidationException) Assert.fail(org.junit.Assert.fail) Test(org.junit.Test) PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) BusinessValidationException(gov.ca.cwds.rest.exception.BusinessValidationException) BaseDocToolRulesPlacementHomeTest(gov.ca.cwds.cms.data.access.service.impl.placementHome.BaseDocToolRulesPlacementHomeTest) Test(org.junit.Test)

Example 4 with PlacementHome

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

the class R04966Test method testPyeMidnmValid.

@Test
public void testPyeMidnmValid() {
    PlacementHome placementHome = new PlacementHome();
    placementHome.setPyeMidnm("A1A");
    placementHomeEntityAwareDTO.setEntity(placementHome);
    assertValid("R-04966");
}
Also used : PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) OtherAdultsInPlacementHome(gov.ca.cwds.data.legacy.cms.entity.OtherAdultsInPlacementHome) OtherChildrenInPlacementHome(gov.ca.cwds.data.legacy.cms.entity.OtherChildrenInPlacementHome) Test(org.junit.Test)

Example 5 with PlacementHome

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

the class R04966Test method testPrmCnctnmInvalid.

@Test
public void testPrmCnctnmInvalid() {
    PlacementHome placementHome = new PlacementHome();
    placementHome.setPrmCnctnm("S 1 A Sr.");
    placementHomeEntityAwareDTO.setEntity(placementHome);
    check("R-04966");
}
Also used : PlacementHome(gov.ca.cwds.data.legacy.cms.entity.PlacementHome) OtherAdultsInPlacementHome(gov.ca.cwds.data.legacy.cms.entity.OtherAdultsInPlacementHome) OtherChildrenInPlacementHome(gov.ca.cwds.data.legacy.cms.entity.OtherChildrenInPlacementHome) Test(org.junit.Test)

Aggregations

PlacementHome (gov.ca.cwds.data.legacy.cms.entity.PlacementHome)29 Test (org.junit.Test)24 OtherAdultsInPlacementHome (gov.ca.cwds.data.legacy.cms.entity.OtherAdultsInPlacementHome)18 OtherChildrenInPlacementHome (gov.ca.cwds.data.legacy.cms.entity.OtherChildrenInPlacementHome)18 DroolsException (gov.ca.cwds.drools.DroolsException)2 BusinessValidationException (gov.ca.cwds.rest.exception.BusinessValidationException)2 PerryAccount (gov.ca.cwds.security.realm.PerryAccount)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 UserTransactionImp (com.atomikos.icatch.jta.UserTransactionImp)1 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)1 PlacementHomeEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.PlacementHomeEntityAwareDTO)1 DataAccessServicesException (gov.ca.cwds.cms.data.access.service.DataAccessServicesException)1 BaseDocToolRulesPlacementHomeTest (gov.ca.cwds.cms.data.access.service.impl.placementHome.BaseDocToolRulesPlacementHomeTest)1 PlacementHomeDroolsConfiguration (gov.ca.cwds.cms.data.access.service.rules.PlacementHomeDroolsConfiguration)1 SubstituteCareProvider (gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)1 ExpectedException (gov.ca.cwds.rest.exception.ExpectedException)1 NoResultException (javax.persistence.NoResultException)1 NotSupportedException (javax.transaction.NotSupportedException)1 SystemException (javax.transaction.SystemException)1 UserTransaction (javax.transaction.UserTransaction)1