Package org.apache.tapestry.util

Examples of org.apache.tapestry.util.RegexpMatcher


    /** @since 4.0 */

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

        RegexpMatch[] matches = m.getMatches("\\w+(=(\\w+))?", "fred,barney=rubble;wilma=flintstone");

        assertEquals(3, matches.length);
       
        assertEquals("fred", matches[0].getInput());
        assertEquals("fred", matches[0].getGroup(0));
View Full Code Here


    /** @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

    /** @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);

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

        verifyControls();
    }

    public void testRenderContribution()
    {
        String pattern = new RegexpMatcher().getEscapedPatternString("\\d+");

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();

        MockControl contextc = newControl(FormComponentContributorContext.class);
View Full Code Here

        verifyControls();
    }

    public void testRenderContributionCustomMessage()
    {
        String pattern = new RegexpMatcher().getEscapedPatternString("\\d+");

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();

        MockControl contextc = newControl(FormComponentContributorContext.class);
View Full Code Here

    public void validate(String value, String pattern, String errorKey)
            throws DocumentParseException
    {
        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

        verifyControls();
    }

    public void testRenderContribution()
    {
        String pattern = new RegexpMatcher().getEscapedPatternString(Email.PATTERN);

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();

        MockControl contextc = newControl(FormComponentContributorContext.class);
View Full Code Here

    }

    public void testRenderContributionCustomMessage()
    {

        String pattern = new RegexpMatcher().getEscapedPatternString(Email.PATTERN);

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();

        MockControl contextc = newControl(FormComponentContributorContext.class);
View Full Code Here

    public void validate(String value, String pattern, String errorKey)
        throws DocumentParseException
    {
        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

    }

    public RegexpMatcher getMatcher()
    {
        if (_matcher == null)
            _matcher = new RegexpMatcher();

        return _matcher;
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.util.RegexpMatcher

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.