ListValueValidatorTest.java revision f2b7e2373c5d1aacf05b91ab8e316d6aea0b948b
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* The contents of this file are subject to the terms of the Common Development and
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* Distribution License (the License). You may not use this file except in compliance with the
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* specific language governing permission and limitations under the License.
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* When distributing Covered Software, include this CDDL Header Notice in each file and include
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* Header, with the fields enclosed by brackets [] replaced by your own identifying
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* information: "Portions copyright [year] [name of copyright owner]".
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna* Copyright 2016 ForgeRock AS.
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Lunaimport static org.assertj.core.api.Assertions.assertThat;
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna private final ListValueValidator validator = new ListValueValidator();
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna return new Object[][] {
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[0]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[ 0]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[0 ]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[ 0 ]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[1]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[99]=ALL", true},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[-1]=ALL", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"asdf=NONE", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[asdf]=ALL", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[asdf]=", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"=ALL", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[]=ALL", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[]=", false},
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna {"[key_and_or_value_contains_=_sign] ==", false}
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna public void checkCorrectness(String name, boolean expected) {
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna boolean result = validator.validate(Collections.singleton(name));
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna public void checkSequentialSetOnlyContainsOneConfigPerApp() {
f2b7e2373c5d1aacf05b91ab8e316d6aea0b948bDavid Luna public void checkMissingNumberInSequentialSetAlsoSucceeds() {