@Test @Parameters(method = "getInvalidFieldsTestData") public void testValidate_UsingInvalidField_ThrowsInvalidEntryException(UserDto dto, String expectedErrorMessage) throws Exception { this.exception.expect(VmidcBrokerInvalidEntryException.class); this.exception.expectMessage(expectedErrorMessage); this.validator.validate(dto); }
void validate(UserDto dto) throws Exception { UserDtoValidator.checkForNullFields(dto); UserDtoValidator.checkFieldLength(dto); if (!StringUtils.isBlank(dto.getEmail())) { ValidateUtil.checkForValidEmailAddress(dto.getEmail()); } ValidateUtil.checkForValidUsername(dto.getLoginName()); ValidateUtil.checkForValidPassword(dto.getPassword()); }
UserDtoValidator implements DtoValidator<UserDto, User> { void validate(UserDto dto) throws Exception { UserDtoValidator.checkForNullFields(dto); UserDtoValidator.checkFieldLength(dto); if (!StringUtils.isBlank(dto.getEmail())) { ValidateUtil.checkForValidEmailAddress(dto.getEmail()); } ValidateUtil.checkForValidUsername(dto.getLoginName()); ValidateUtil.checkForValidPassword(dto.getPassword()); } }
UserDtoValidator implements DtoValidator<UserDto, User> { void validate(UserDto dto) throws Exception { UserDtoValidator.checkForNullFields(dto); UserDtoValidator.checkFieldLength(dto); if (!StringUtils.isBlank(dto.getEmail())) { ValidateUtil.checkForValidEmailAddress(dto.getEmail()); } ValidateUtil.checkForValidUsername(dto.getLoginName()); ValidateUtil.checkForValidPassword(dto.getPassword()); } UserDtoValidator(EntityManager em, TransactionalBroadcastUtil txBroadcastUtil); }
UserDtoValidator implements DtoValidator<UserDto, User> { void validate(UserDto dto) throws Exception { UserDtoValidator.checkForNullFields(dto); UserDtoValidator.checkFieldLength(dto); if (!StringUtils.isBlank(dto.getEmail())) { ValidateUtil.checkForValidEmailAddress(dto.getEmail()); } ValidateUtil.checkForValidUsername(dto.getLoginName()); ValidateUtil.checkForValidPassword(dto.getPassword()); } UserDtoValidator(EntityManager em, TransactionalBroadcastUtil txBroadcastUtil); @Override void validateForCreate(UserDto dto); @Override User validateForUpdate(UserDto dto); static void checkForNullFields(UserDto dto); static void checkFieldLength(UserDto dto); }
UserDtoValidator implements DtoValidator<UserDto, User> { void validate(UserDto dto) throws Exception { UserDtoValidator.checkForNullFields(dto); UserDtoValidator.checkFieldLength(dto); if (!StringUtils.isBlank(dto.getEmail())) { ValidateUtil.checkForValidEmailAddress(dto.getEmail()); } ValidateUtil.checkForValidUsername(dto.getLoginName()); ValidateUtil.checkForValidPassword(dto.getPassword()); } UserDtoValidator(EntityManager em, TransactionalBroadcastUtil txBroadcastUtil); @Override void validateForCreate(UserDto dto); @Override User validateForUpdate(UserDto dto); static void checkForNullFields(UserDto dto); static void checkFieldLength(UserDto dto);  }