mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
02.33.2014 e114a899bbc0df59f5135f195d24797bf6c1b778
opendj-sdk/opendj-admin/src/test/java/org/opends/server/admin/StringPropertyDefinitionTest.java
@@ -29,47 +29,40 @@
import org.forgerock.opendj.admin.meta.RootCfgDefn;
import org.forgerock.opendj.config.ConfigTestCase;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@SuppressWarnings("javadoc")
public class StringPropertyDefinitionTest extends ConfigTestCase {
    @BeforeClass
    public void setUp() {
        disableClassValidationForProperties();
    }
    @Test
    public void testValidateValueNoPattern() {
        StringPropertyDefinition d = getDefinition(true, null);
        d.validateValue("abc");
        d.validateValue("abc", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
    }
    @Test
    public void testValidateValuePatternMatches() {
        StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
        d.validateValue("abc");
        d.validateValue("abc", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
    }
    // TODO : I18N problem
    @Test(enabled = false, expectedExceptions = IllegalPropertyValueException.class)
    public void testValidateValuePatternDoesNotMatch() {
        StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
        d.validateValue("abc123");
        d.validateValue("abc123", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
    }
    @Test
    public void testDecodeValuePatternMatches() {
        StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
        assertEquals(d.decodeValue("abc"), "abc");
        assertEquals(d.decodeValue("abc", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS), "abc");
    }
    // TODO : I18N problem
    @Test(enabled = false, expectedExceptions = IllegalPropertyValueStringException.class)
    public void testDecodeValuePatternDoesNotMatch() {
        StringPropertyDefinition d = getDefinition(true, "^[a-z]+$");
        d.decodeValue("abc123");
        d.decodeValue("abc123", PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS);
    }
    // Create a string property definition.