| | |
| | | |
| | | import org.forgerock.opendj.admin.meta.RootCfgDefn; |
| | | import org.forgerock.opendj.config.ConfigTestCase; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class IntegerPropertyDefinitionTest extends ConfigTestCase { |
| | | |
| | | @BeforeClass |
| | | public void setUp() { |
| | | disableClassValidationForProperties(); |
| | | } |
| | | |
| | | @Test |
| | | public void testCreateBuilder() { |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setAllowUnlimited(true); |
| | | IntegerPropertyDefinition propertyDef = buildTestDefinition(builder); |
| | | propertyDef.decodeValue("unlimited"); |
| | | propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @Test(expectedExceptions = IllegalPropertyValueStringException.class) |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setAllowUnlimited(false); |
| | | IntegerPropertyDefinition propertyDef = buildTestDefinition(builder); |
| | | propertyDef.decodeValue("unlimited"); |
| | | propertyDef.decodeValue("unlimited", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @Test(expectedExceptions = IllegalPropertyValueException.class) |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setAllowUnlimited(false); |
| | | IntegerPropertyDefinition propertyDef = buildTestDefinition(builder); |
| | | propertyDef.validateValue(-1); |
| | | propertyDef.validateValue(-1, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @DataProvider(name = "validateValueData") |
| | |
| | | builder.setUpperLimit(high); |
| | | builder.setAllowUnlimited(allowUnlimited); |
| | | IntegerPropertyDefinition propertyDef = buildTestDefinition(builder); |
| | | propertyDef.validateValue(valueToValidate); |
| | | propertyDef.validateValue(valueToValidate, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @DataProvider(name = "illegalValidateValueData") |
| | |
| | | builder.setUpperLimit(high); |
| | | builder.setAllowUnlimited(allowUnlimited); |
| | | IntegerPropertyDefinition propertyDef = buildTestDefinition(builder); |
| | | propertyDef.validateValue(value); |
| | | propertyDef.validateValue(value, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @DataProvider(name = "encodeValueData") |