@Test(expected = ValidationException.class) public void testFailureValidate() { final HashMap<String, Serializable> map = new HashMap<String, Serializable>(); map.put("key", rejectValue); sut = new MapParameterRejectStringValueValidator("key", rejectValue, "No dice!"); sut.validate(map, new HashMap<String, String>()); }
public void validate(final Map<String, Serializable> map, final Map<String, String> errors) { if (map.get(key) != null && (map.get(key) instanceof String) && (((String) map.get(key)).compareToIgnoreCase(valueToReject)) == 0) { errors.put(key, message); } if (valDecorator != null) { valDecorator.validate(map, errors); } else if (!errors.isEmpty()) { ValidationException ve = new ValidationException(); for (String errorKey : errors.keySet()) { ve.addError(errorKey, errors.get(errorKey)); } throw ve; } }
MapParameterRejectStringValueValidator implements MapParameterValidatorDecorator { public void validate(final Map<String, Serializable> map, final Map<String, String> errors) { if (map.get(key) != null && (map.get(key) instanceof String) && (((String) map.get(key)).compareToIgnoreCase(valueToReject)) == 0) { errors.put(key, message); } if (valDecorator != null) { valDecorator.validate(map, errors); } else if (!errors.isEmpty()) { ValidationException ve = new ValidationException(); for (String errorKey : errors.keySet()) { ve.addError(errorKey, errors.get(errorKey)); } throw ve; } } }
MapParameterRejectStringValueValidator implements MapParameterValidatorDecorator { public void validate(final Map<String, Serializable> map, final Map<String, String> errors) { if (map.get(key) != null && (map.get(key) instanceof String) && (((String) map.get(key)).compareToIgnoreCase(valueToReject)) == 0) { errors.put(key, message); } if (valDecorator != null) { valDecorator.validate(map, errors); } else if (!errors.isEmpty()) { ValidationException ve = new ValidationException(); for (String errorKey : errors.keySet()) { ve.addError(errorKey, errors.get(errorKey)); } throw ve; } } MapParameterRejectStringValueValidator(final String inKey, final String inValueToReject,
            final String inMessage); }
MapParameterRejectStringValueValidator implements MapParameterValidatorDecorator { public void validate(final Map<String, Serializable> map, final Map<String, String> errors) { if (map.get(key) != null && (map.get(key) instanceof String) && (((String) map.get(key)).compareToIgnoreCase(valueToReject)) == 0) { errors.put(key, message); } if (valDecorator != null) { valDecorator.validate(map, errors); } else if (!errors.isEmpty()) { ValidationException ve = new ValidationException(); for (String errorKey : errors.keySet()) { ve.addError(errorKey, errors.get(errorKey)); } throw ve; } } MapParameterRejectStringValueValidator(final String inKey, final String inValueToReject,
            final String inMessage); void setMapParameterValidatorDecorator(final MapParameterValidatorDecorator inDecorated); void validate(final Map<String, Serializable> map, final Map<String, String> errors); }
MapParameterRejectStringValueValidator implements MapParameterValidatorDecorator { public void validate(final Map<String, Serializable> map, final Map<String, String> errors) { if (map.get(key) != null && (map.get(key) instanceof String) && (((String) map.get(key)).compareToIgnoreCase(valueToReject)) == 0) { errors.put(key, message); } if (valDecorator != null) { valDecorator.validate(map, errors); } else if (!errors.isEmpty()) { ValidationException ve = new ValidationException(); for (String errorKey : errors.keySet()) { ve.addError(errorKey, errors.get(errorKey)); } throw ve; } } MapParameterRejectStringValueValidator(final String inKey, final String inValueToReject,
            final String inMessage); void setMapParameterValidatorDecorator(final MapParameterValidatorDecorator inDecorated); void validate(final Map<String, Serializable> map, final Map<String, String> errors);  }