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