### Question:
DurationPropertyDefinition extends PropertyDefinition<Long> { @Override public void validateValue(Long value) throws PropertyException { ifNull(value); long nvalue = baseUnit.toMilliSeconds(value); if (!allowUnlimited && nvalue < lowerLimit) { throw PropertyException.illegalPropertyValueException(this, value); } else if (nvalue >= 0 && nvalue < lowerLimit) { throw PropertyException.illegalPropertyValueException(this, value); } if (upperLimit != null && nvalue > upperLimit) { throw PropertyException.illegalPropertyValueException(this, value); } } private  DurationPropertyDefinition(AbstractManagedObjectDefinition<?, ?> d,
      String propertyName, EnumSet<PropertyOption> options,
      AdministratorAction adminAction,
      DefaultBehaviorProvider<Long> defaultBehavior, DurationUnit baseUnit,
      DurationUnit maximumUnit, Long lowerLimit, Long upperLimit,
      boolean allowUnlimited); static Builder createBuilder(AbstractManagedObjectDefinition<?, ?> d,
      String propertyName); DurationUnit getBaseUnit(); DurationUnit getMaximumUnit(); 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 testIsAllowUnlimited3() { DurationPropertyDefinition.Builder builder = createTestBuilder(); builder.setAllowUnlimited(false); DurationPropertyDefinition spd = buildTestDefinition(builder); spd.validateValue(-1L); }
@Test(dataProvider = "validateValueData") public void testValidateValue1(Long low, Long high, boolean allowUnlimited, Long value) { DurationPropertyDefinition.Builder builder = createTestBuilder(); builder.setLowerLimit(low); builder.setUpperLimit(high); builder.setAllowUnlimited(allowUnlimited); DurationPropertyDefinition spd = buildTestDefinition(builder); spd.validateValue(value); }
@Test(dataProvider = "illegalValidateValueData", expectedExceptions = {AssertionError.class,NullPointerException.class,PropertyException.class}) public void testValidateValue2(Long low, Long high, boolean allowUnlimited, Long value) { DurationPropertyDefinition.Builder builder = createTestBuilder(); builder.setLowerLimit(low); builder.setUpperLimit(high); builder.setAllowUnlimited(allowUnlimited); DurationPropertyDefinition spd = buildTestDefinition(builder); spd.validateValue(value); }