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;
}
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());
}
}
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");
}
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));
}
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));
}
Aggregations