Package org.apache.cocoon.sitemap.matcher

Examples of org.apache.cocoon.sitemap.matcher.WildcardMatcher.match()


public class WildcardMatcherTest {

    @Test
    public void testMatcher() {
        WildcardMatcher matcher = new WildcardMatcher();
        Map<String, String> result = matcher.match("*/{name}/**/{id}", "abc/def/ghi/jkl/5");
        Assert.assertEquals("A parameter 'name' is expected.", "def", result.get("name"));
        Assert.assertEquals("A parameter 'id' is expected.", "5", result.get("id"));
        Assert.assertEquals("A result value '1' is expected.", "abc", result.get("1"));
        Assert.assertEquals("A result value '2' is expected.", "def", result.get("2"));
        Assert.assertEquals("A result value '3' is expected.", "ghi/jkl", result.get("3"));
View Full Code Here


    }

    @Test
    public void testMatcherWithoutParamters() {
        WildcardMatcher matcher = new WildcardMatcher();
        Map<String, String> result = matcher.match("*/**", "abc/def/ghi/jkl/5");
        Assert.assertEquals("A result value '1' is expected.", "abc", result.get("1"));
        Assert.assertEquals("A result value '2' is expected.", "def/ghi/jkl/5", result.get("2"));
        Assert.assertEquals("A result value '0' is expected.", "abc/def/ghi/jkl/5", result.get("0"));
    }

View Full Code Here

    }

    @Test
    public void testMatcherWithoutWildcards() {
        WildcardMatcher matcher = new WildcardMatcher();
        Map<String, String> result = matcher.match("abc", "abc");
        Assert.assertNull("No matching result", result.get("1"));
        Assert.assertEquals("A result value '0' is expected.", "abc", result.get("0"));
    }

    @Test
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.