@Test
    public void testVerification() {
        ConfigDefinition def = new ConfigDefinition("foo", "bar");
        def.addBoolDef("boolval");
        def.addStringDef("stringval");
        def.addIntDef("intval");
        def.addLongDef("longval");
        def.addDoubleDef("doubleval");
        def.addEnumDef("enumval", new EnumDef(List.of("FOO"), "FOO"));
        def.addReferenceDef("refval");
        def.addFileDef("fileval");
        def.addPathDef("pathVal");
        def.addOptionalPathDef("optionalPathVal");
        def.addInnerArrayDef("innerarr");
        def.addLeafMapDef("leafmap");
        ConfigDefinition.ArrayDef intArray = def.arrayDef("intArray");
        intArray.setTypeSpec(new ConfigDefinition.TypeSpec("intArray", "int", null, null, Integer.MIN_VALUE, Integer.MAX_VALUE));

        ConfigDefinition.ArrayDef longArray = def.arrayDef("longArray");
        longArray.setTypeSpec(new ConfigDefinition.TypeSpec("longArray", "long", null, null, Long.MIN_VALUE, Long.MAX_VALUE));

        ConfigDefinition.ArrayDef doubleArray = def.arrayDef("doubleArray");
        doubleArray.setTypeSpec(new ConfigDefinition.TypeSpec("doubleArray", "double", null, null, Double.MIN_VALUE, Double.MAX_VALUE));

        ConfigDefinition.ArrayDef enumArray = def.arrayDef("enumArray");
        enumArray.setTypeSpec(new ConfigDefinition.TypeSpec("enumArray", "enum", null, "VALID", null, null));

        ConfigDefinition.ArrayDef stringArray = def.arrayDef("stringArray");
        stringArray.setTypeSpec(new ConfigDefinition.TypeSpec("stringArray", "string", null, null, null, null));

        def.structDef("struct");

        assertVerify(def, "boolval", "true");
        assertVerify(def, "boolval", "false");
        assertVerify(def, "boolval", "invalid", IllegalArgumentException.class);


        assertVerify(def, "stringval", "foobar");
        assertVerify(def, "stringval", "foobar");
        assertVerify(def, "intval", "123");
        assertVerify(def, "intval", "foobar", IllegalArgumentException.class);
        assertVerify(def, "longval", "1234");
        assertVerify(def, "longval", "foobar", IllegalArgumentException.class);
        assertVerify(def, "doubleval", "foobar", IllegalArgumentException.class);
        assertVerify(def, "doubleval", "3");
        assertVerify(def, "doubleval", "3.14");
        assertVerify(def, "enumval", "foobar", IllegalArgumentException.class);
        assertVerify(def, "enumval", "foo", IllegalArgumentException.class);
        assertVerify(def, "enumval", "FOO");
        assertVerify(def, "refval", "foobar");
        assertVerify(def, "fileval", "foobar");
        assertVerify(def, "pathVal", "foobar");
        assertVerify(def, "optionalPathVal", "foobar");

        assertVerifyComplex(def, "innerarr");
        assertVerifyComplex(def, "leafmap");
        assertVerifyComplex(def, "intArray");
        assertVerifyComplex(def, "longArray");
        assertVerifyComplex(def, "doubleArray");
        assertVerifyComplex(def, "enumArray");
        assertVerifyComplex(def, "stringArray");
        assertVerifyArray(intArray, "1345", 0);
        assertVerifyArray(intArray, "invalid", 0, IllegalArgumentException.class);
        assertVerifyArray(longArray, "1345", 0);
        assertVerifyArray(longArray, "invalid", 0, IllegalArgumentException.class);
        assertVerifyArray(doubleArray, "1345", 0);
        assertVerifyArray(doubleArray, "1345.3", 0);
        assertVerifyArray(doubleArray, "invalid", 0, IllegalArgumentException.class);
        assertVerifyArray(enumArray, "valid", 0, IllegalArgumentException.class);
        assertVerifyArray(enumArray, "VALID", 0);
        assertVerifyArray(enumArray, "inVALID", 0, IllegalArgumentException.class);
        assertVerifyArray(stringArray, "VALID", 0);
        assertVerifyComplex(def, "struct");
    }
Unit tests for ConfigDefinition.

@author hmusum
config/src/test/java/com/yahoo/vespa/config/ConfigDefinitionTest.java