Search in sources :

Example 1 with SubstituteCareProvider

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

the class SubstituteCareProviderCreateAuthorizerTest method initSCP.

private SubstituteCareProvider initSCP() {
    final SubstituteCareProvider substituteCareProvider = new SubstituteCareProvider();
    substituteCareProvider.setIdentifier("id");
    return substituteCareProvider;
}
Also used : SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)

Example 2 with SubstituteCareProvider

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

the class SubstituteCareProviderServiceImplTest method createValidatePhoneNumberNotPersisted.

@Test
public void createValidatePhoneNumberNotPersisted() throws Exception {
    try {
        SubstituteCareProviderCoreService service = new SubstituteCareProviderCoreService(mock(SubstituteCareProviderDao.class));
        SubstituteCareProvider scp = new SubstituteCareProvider();
        SCPEntityAwareDTO parameterObject = new SCPEntityAwareDTO();
        parameterObject.setEntity(scp);
        List<PhoneContactDetail> phoneNumbers = new ArrayList<>();
        PhoneContactDetail phoneContactDetail = new PhoneContactDetail();
        phoneContactDetail.setThirdId("1");
        phoneNumbers.add(phoneContactDetail);
        parameterObject.setPhoneNumbers(phoneNumbers);
        service.create(parameterObject);
        fail();
    } catch (IllegalStateException e) {
        assertEquals(String.format(ParametersValidator.INSTANCE_MUST_NOT_BE_PERSISTED, PhoneContactDetail.class.getSimpleName()), e.getMessage());
    }
}
Also used : PhoneContactDetail(gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail) SubstituteCareProviderDao(gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao) SubstituteCareProviderCoreService(gov.ca.cwds.cms.data.access.service.impl.SubstituteCareProviderCoreService) ArrayList(java.util.ArrayList) SCPEntityAwareDTO(gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO) SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) Test(org.junit.Test)

Example 3 with SubstituteCareProvider

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

the class R04966Test method testMidIniNmInalid.

@Test
public void testMidIniNmInalid() {
    SubstituteCareProvider substituteCareProvider = entityAwareDTO.getEntity();
    substituteCareProvider.setMidIniNm("11");
    checkFail("R-04966");
}
Also used : SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) Test(org.junit.Test)

Example 4 with SubstituteCareProvider

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

the class SubstituteCareProviderCreateAuthorizerTest 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 SubstituteCareProvider substituteCareProvider = initSCP();
    // when
    final boolean actual = testSubject.checkInstance(substituteCareProvider);
    // then
    assertThat(actual, is(true));
}
Also used : SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with SubstituteCareProvider

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

the class SubstituteCareProviderCreateAuthorizerTest 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 SubstituteCareProvider substituteCareProvider = initSCP();
    // when
    final boolean actual = testSubject.checkInstance(substituteCareProvider);
    // then
    assertThat(actual, is(false));
}
Also used : SubstituteCareProvider(gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider) PerryAccount(gov.ca.cwds.security.realm.PerryAccount) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

SubstituteCareProvider (gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)17 Test (org.junit.Test)13 SCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)5 SubstituteCareProviderDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao)3 SubstituteCareProviderCoreService (gov.ca.cwds.cms.data.access.service.impl.SubstituteCareProviderCoreService)3 PerryAccount (gov.ca.cwds.security.realm.PerryAccount)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 ExtendedSCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.ExtendedSCPEntityAwareDTO)2 BusinessValidationService (gov.ca.cwds.cms.data.access.service.BusinessValidationService)2 PhoneContactDetail (gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail)2 PlacementHomeInformation (gov.ca.cwds.data.legacy.cms.entity.PlacementHomeInformation)2 Inject (com.google.inject.Inject)1 CWSIdentifier (gov.ca.cwds.cms.data.access.CWSIdentifier)1 Constants (gov.ca.cwds.cms.data.access.Constants)1 PhoneticSearchTables (gov.ca.cwds.cms.data.access.Constants.PhoneticSearchTables)1 CountyOwnershipDao (gov.ca.cwds.cms.data.access.dao.CountyOwnershipDao)1 OutOfStateCheckDao (gov.ca.cwds.cms.data.access.dao.OutOfStateCheckDao)1 PhoneContactDetailDao (gov.ca.cwds.cms.data.access.dao.PhoneContactDetailDao)1 PlacementHomeInformationDao (gov.ca.cwds.cms.data.access.dao.PlacementHomeInformationDao)1 ScpOtherEthnicityDao (gov.ca.cwds.cms.data.access.dao.ScpOtherEthnicityDao)1