Java 类com.hazelcast.config.properties.ValidationException 实例源码

项目:hazelcast-aws    文件:AwsProperties.java   
/**
 * Returns a validation
 *
 * @param value the integer to validate
 * @throws ValidationException if value does not fall in valid port number range
 */
public void validate(Integer value) throws ValidationException {
    if (value < MIN_PORT) {
        throw new ValidationException("hz-port number must be greater 0");
    }
    if (value > MAX_PORT) {
        throw new ValidationException("hz-port number must be less or equal to 65535");
    }
}
项目:hazelcast-jclouds    文件:JCloudsProperties.java   
public void validate(Integer value) throws ValidationException {
    if (value < MIN_PORT) {
        throw new ValidationException("hz-port number must be greater 0");
    }
    if (value > MAX_PORT) {
        throw new ValidationException("hz-port number must be less or equal to 65535");
    }
}
项目:hazelcast-jclouds    文件:JCloudsPropertiesTest.java   
@Test
public void portValueValidator_should_not_throw_ValidationException_when_configured_in_range_values() {
    try {
        JCloudsProperties.PortValueValidator valueValidator = new JCloudsProperties.PortValueValidator();
        valueValidator.validate(5701);
    } catch (ValidationException e) {
        fail("PortValueValidator should not throw ValidationException when configured in range values");
    }
}
项目:hazelcast-aws    文件:AwsPropertiesTest.java   
@Test(expected = ValidationException.class)
public void testPortValueValidator_validate_negative_val() throws Exception {
    final AwsProperties.PortValueValidator validator = new AwsProperties.PortValueValidator();
    validator.validate(-1);
}
项目:hazelcast-aws    文件:AwsPropertiesTest.java   
@Test(expected = ValidationException.class)
public void testPortValueValidatorValidateTooBig() throws Exception {
    final AwsProperties.PortValueValidator validator = new AwsProperties.PortValueValidator();
    validator.validate(65536);
}