### Question:
SizePropertyDefinition extends PropertyDefinition<Long> { @Override public void validateValue(Long value) { Reject.ifNull(value); if (!allowUnlimited && value < lowerLimit) { throw PropertyException.illegalPropertyValueException(this, value); } else if (value >= 0 && value < lowerLimit) { throw PropertyException.illegalPropertyValueException(this, value); } if (upperLimit != null && value > upperLimit) { throw PropertyException.illegalPropertyValueException(this, value); } } private  SizePropertyDefinition(AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options, AdministratorAction adminAction,
        DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit, Long upperLimit, boolean allowUnlimited); static Builder createBuilder(AbstractManagedObjectDefinition<?, ?> d, String propertyName); long getLowerLimit(); Long getUpperLimit(); boolean isAllowUnlimited(); @Override void validateValue(Long value); @Override String encodeValue(Long value); @Override Long decodeValue(String value); @Override R accept(PropertyDefinitionVisitor<R, P> v, P p); @Override R accept(PropertyValueVisitor<R, P> v, Long value, P p); @Override void toString(StringBuilder builder); @Override int compare(Long o1, Long o2);  }### Answer:
@Test(expectedExceptions = PropertyException.class) public void testIsAllowUnlimitedNumeric() { SizePropertyDefinition.Builder builder = createTestBuilder(); builder.setAllowUnlimited(false); SizePropertyDefinition propertyDef = buildTestDefinition(builder); propertyDef.validateValue(-1L); }
@Test(dataProvider = "validateValueData") public void testValidateValue(Long low, Long high, boolean isAllowUnlimited, Long valueToValidate) { SizePropertyDefinition.Builder builder = createTestBuilder(); builder.setLowerLimit(low); builder.setUpperLimit(high); builder.setAllowUnlimited(isAllowUnlimited); SizePropertyDefinition propertyDef = buildTestDefinition(builder); propertyDef.validateValue(valueToValidate); }
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = { AssertionError.class, NullPointerException.class, PropertyException.class }) public void testValidateValueIllegal(Long low, Long high, boolean allowUnlimited, Long valueToValidate) { SizePropertyDefinition.Builder builder = createTestBuilder(); builder.setLowerLimit(low); builder.setUpperLimit(high); builder.setAllowUnlimited(allowUnlimited); SizePropertyDefinition propertyDef = buildTestDefinition(builder); propertyDef.validateValue(valueToValidate); }