Search in sources :

Example 1 with PhoneContactDetail

use of gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail 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)

Aggregations

SubstituteCareProviderDao (gov.ca.cwds.cms.data.access.dao.SubstituteCareProviderDao)1 SCPEntityAwareDTO (gov.ca.cwds.cms.data.access.dto.SCPEntityAwareDTO)1 SubstituteCareProviderCoreService (gov.ca.cwds.cms.data.access.service.impl.SubstituteCareProviderCoreService)1 PhoneContactDetail (gov.ca.cwds.data.legacy.cms.entity.PhoneContactDetail)1 SubstituteCareProvider (gov.ca.cwds.data.legacy.cms.entity.SubstituteCareProvider)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1