Examples of RegexpMatcher


Examples of org.apache.tapestry.util.RegexpMatcher

        }
    }

    public void testClear()
    {
        RegexpMatcher m = new RegexpMatcher();

        m.clear();
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        m.clear();
    }

    public void testContains()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(m.contains("[a-z]+", "c"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514"));
        assertTrue(m.contains("^(\\d{5}(-\\d{4})?)$", "06514-3149"));
        assertTrue(m.contains("foo|foot", "12foot12"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(m.contains("foo|foot", "12foot12"));
    }

    public void testNotContains()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(!m.contains("[0-9]+", "q"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "0651"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "065147"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "06514-314"));
        assertTrue(!m.contains("^(\\d{5}(-\\d{4})?)$", "06514-31497"));
        assertTrue(!m.contains("^(foo|foot)$", "12foot12"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(!m.contains("^(foo|foot)$", "12foot12"));
    }

    public void testGetEscapedPatternStrings()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertEquals(m.getEscapedPatternString("^\\d$"), "\\^\\\\d\\$");
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 4.0 */

    public void testGetMatches()
    {
        RegexpMatcher m = new RegexpMatcher();

        String[] matches = m.getMatches("\\d+", "57,232 89 147", 0);

        assertListsEqual(new String[]
        { "57", "232", "89", "147" }, matches);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 4.0 */

    public void testGetMatchesNoMatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        String[] matches = m.getMatches("A(B|C)", "aBCAaBA", 0);

        assertEquals(0, matches.length);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

    /** @since 4.0 */

    public void testGetMatchesSubgroup()
    {
        RegexpMatcher m = new RegexpMatcher();

        String matches[] = m.getMatches("A(B|C|fred)", "AA AC AB Afred AA AC", 1);

        assertListsEqual(new String[]
        { "C", "B", "fred", "C" }, matches);
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

     */

    public void validate(String value, String pattern, String errorKey)
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        if (_matcher.matches(pattern, value))
            return;

        throw new InvalidStringException(Tapestry.format(errorKey, value), value, getLocation());
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

public class TestRegexpMatcher extends TapestryTestCase
{

    public void testMatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(m.matches("[a-z]+", "c"));
        assertTrue(m.matches("foo|foot", "foo"));
    }
View Full Code Here

Examples of org.apache.tapestry.util.RegexpMatcher

        assertTrue(m.matches("foo|foot", "foo"));
    }

    public void testNonmatch()
    {
        RegexpMatcher m = new RegexpMatcher();

        assertTrue(!m.matches("[0-9]+", "q"));
        assertTrue(!m.matches("foo|foot", "foot"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.