Package org.lilyproject.indexer.model.indexerconf

Examples of org.lilyproject.indexer.model.indexerconf.WildcardPattern.match()


public class WildcardPatternTest {
    @Test
    public void testStartsWith() throws Exception {
        WildcardPattern pattern = new WildcardPattern("foo*");
        Pair<Boolean, String> result = pattern.match("foobar");
        assertTrue(result.getV1());
        assertEquals("bar", result.getV2());

        result = pattern.match("fobar");
        assertFalse(result.getV1());
View Full Code Here


        WildcardPattern pattern = new WildcardPattern("foo*");
        Pair<Boolean, String> result = pattern.match("foobar");
        assertTrue(result.getV1());
        assertEquals("bar", result.getV2());

        result = pattern.match("fobar");
        assertFalse(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("foo");
        assertTrue(result.getV1());
View Full Code Here

        result = pattern.match("fobar");
        assertFalse(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("foo");
        assertTrue(result.getV1());
        assertEquals("", result.getV2());
    }

    @Test
View Full Code Here

    }

    @Test
    public void testEndsWith() throws Exception {
        WildcardPattern pattern = new WildcardPattern("*bar");
        Pair<Boolean, String> result = pattern.match("foobar");
        assertTrue(result.getV1());
        assertEquals("foo", result.getV2());

        result = pattern.match("fooba");
        assertFalse(result.getV1());
View Full Code Here

        WildcardPattern pattern = new WildcardPattern("*bar");
        Pair<Boolean, String> result = pattern.match("foobar");
        assertTrue(result.getV1());
        assertEquals("foo", result.getV2());

        result = pattern.match("fooba");
        assertFalse(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("bar");
        assertTrue(result.getV1());
View Full Code Here

        result = pattern.match("fooba");
        assertFalse(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("bar");
        assertTrue(result.getV1());
        assertEquals("", result.getV2());
    }

    @Test
View Full Code Here

    }

    @Test
    public void testEquals() throws Exception {
        WildcardPattern pattern = new WildcardPattern("foobar");
        Pair<Boolean, String> result = pattern.match("foobar");
        assertTrue(result.getV1());
        assertNull(result.getV2());

        // A star at any other position than end or start is not recognized as a wildcard
        pattern = new WildcardPattern("foo*bar");
 
View Full Code Here

        assertTrue(result.getV1());
        assertNull(result.getV2());

        // A star at any other position than end or start is not recognized as a wildcard
        pattern = new WildcardPattern("foo*bar");
        result = pattern.match("foo*bar");
        assertTrue(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("foo1bar");
        assertFalse(result.getV1());
View Full Code Here

        pattern = new WildcardPattern("foo*bar");
        result = pattern.match("foo*bar");
        assertTrue(result.getV1());
        assertNull(result.getV2());

        result = pattern.match("foo1bar");
        assertFalse(result.getV1());
    }

    @Test
    public void testSpecial() throws Exception {
View Full Code Here

    @Test
    public void testSpecial() throws Exception {
        // A star by itself is not a wildcard
        WildcardPattern pattern = new WildcardPattern("*");
        Pair<Boolean, String> result = pattern.match("foo");
        assertTrue(result.getV1());
        assertEquals("foo", result.getV2());

        result = pattern.match("");
        assertTrue(result.getV1());
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.