Package com.volantis.styling.impl.engine.matchers.constraints

Examples of com.volantis.styling.impl.engine.matchers.constraints.ValueConstraint


    /**
     * Test that it matches the prefix of a language code.
     */
    public void testMatchesLanguagePrefix() {
        ValueConstraint constraint = createConstraint("abc");
        assertTrue("Language string did not match",
                constraint.satisfied("abc"));
        assertTrue("Language string did not match",
                   constraint.satisfied("abc-"));
        assertTrue("Language string did not match",
                constraint.satisfied("abc-def"));
        assertFalse("Language string should not match",
                constraint.satisfied("abcdef"));
        assertFalse("Language string should not match",
                constraint.satisfied("ab"));
        assertFalse("Language string should not match",
                constraint.satisfied(""));
    }
View Full Code Here


    /**
     * Test that a null local name fails.
     */
    public void testNullLocalNameFails() {
        try {
            ValueConstraint constraint = new ValueConstraintMock(
                    "constraintMock", expectations);
            new AttributeMatcher(null, null, constraint);
            fail("Null localName not detected");
        } catch (IllegalArgumentException e) {
            assertEquals("Error message incorrect",
View Full Code Here

    /**
     * Test that it matches the prefix of a long language code.
     */
    public void testMatchesLongLanguagePrefix() {
        ValueConstraint constraint = createConstraint("abc-xyz");
        assertTrue("Language string did not match",
                constraint.satisfied("abc-xyz"));
        assertTrue("Language string did not match",
                constraint.satisfied("abc-xyz-"));
        assertTrue("Language string did not match",
                   constraint.satisfied("abc-xyz-qrs"));
        assertFalse("Language string should not match",
                constraint.satisfied("abc-xyzqrs"));
        assertFalse("Language string should not match",
                constraint.satisfied("abc-x"));
        assertFalse("Language string should not match",
                constraint.satisfied("abc-"));
        assertFalse("Language string should not match",
                constraint.satisfied("ab"));
        assertFalse("Language string should not match",
                constraint.satisfied(""));
    }
View Full Code Here

    /**
     * Test that a value that is the only word in the list succeeds.
     */
    public void testOnlyWord() {
        ValueConstraint constraint = new ListContains("alpha");
        assertTrue("Only word did not match",
                   constraint.satisfied("alpha"));
    }
View Full Code Here

    /**
     * Test that a value that is the first word in the list succeeds.
     */
    public void testFirstWord() {
        ValueConstraint constraint = new ListContains("alpha");
        assertTrue("First word did not match",
                   constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

    /**
     * Test that a value that is the middle word in the list succeeds.
     */
    public void testMiddleWord() {
        ValueConstraint constraint = new ListContains("beta");
        assertTrue("Middle word did not match",
                   constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

    /**
     * Test that a value that is the last word in the list succeeds.
     */
    public void testLastWord() {
        ValueConstraint constraint = new ListContains("gamma");
        assertTrue("Last word did not match",
                   constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

    /**
     * Test that a value that is a suffix of an item works.
     */
    public void testWordSuffix() {
        ValueConstraint constraint = new ListContains("eta");
        assertFalse("Suffix matched",
                    constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

    /**
     * Test that a value that is a prefix of an item works.
     */
    public void testWordPrefix() {
        ValueConstraint constraint = new ListContains("bet");
        assertFalse("Prefix matched",
                    constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

    /**
     * Test that a value that is not in the list works.
     */
    public void testMismatchWord() {
        ValueConstraint constraint = new ListContains("epsilon");
        assertFalse("Mismatch word matched",
                    constraint.satisfied("alpha beta gamma"));
    }
View Full Code Here

TOP

Related Classes of com.volantis.styling.impl.engine.matchers.constraints.ValueConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.