PropertyValidator { public void validateProperties() { validate(); safeguardLimitValidator.validate(); }  void validateProperties(); void setProperties(final Properties properties);  }
@Test public void testValidatePropertiesShouldPass() { String validationExpression = "#this >1"; String propertyValue = "1234"; properties.put("proxy.port", validationExpression); propertyHolder.addProperty("proxy.port", propertyValue); underTest.validateProperties(); }
@Test(expectedExceptions = InvalidPropertyException.class) public void testValidatePropertiesWhenInvalidPropertyShouldThrowException() { String validationExpression = "#this >1"; String propertyValue = "0"; properties.put("proxy.port", validationExpression); propertyHolder.addProperty("proxy.port", propertyValue); underTest.validateProperties(); }
@Test(expectedExceptions = InvalidPropertyException.class) public void testValidatePropertiesWhenNumberFormatExceptionShouldThrowException() { String validationExpression = "#this >1"; String propertyValue = "bla"; properties.put("proxy.port", validationExpression); propertyHolder.addProperty("proxy.port", propertyValue); underTest.validateProperties(); }
@Test(expectedExceptions = InvalidPropertyException.class) public void testValidatePropertiesWhenOgnlExceptionShouldThrowException() { String validationExpression = "#this >1 bla"; String propertyValue = "0"; properties.put("proxy.port", validationExpression); propertyHolder.addProperty("proxy.port", propertyValue); underTest.validateProperties(); }