Package org.joni

Examples of org.joni.Regex


    @SuppressWarnings("NumericCastThatLosesPrecision")
    @Test(timeOut = 1000)
    public void testLikeInvalidUtf8Value()
    {
        Slice value = Slices.wrappedBuffer(new byte[] {'a', 'b', 'c', (byte) 0xFF, 'x', 'y'});
        Regex regex = likePattern(utf8Slice("%b%"), utf8Slice("\\"));
        assertTrue(like(value, regex));
    }
View Full Code Here


    @Test
    public void testBackslashesNoSpecialTreatment()
            throws Exception
    {
        Regex regex = likePattern(utf8Slice("\\abc\\/\\\\"));
        assertTrue(like(utf8Slice("\\abc\\/\\\\"), regex));
    }
View Full Code Here

    @Test
    public void testSelfEscaping()
            throws Exception
    {
        Regex regex = likePattern(utf8Slice("\\\\abc\\%"), utf8Slice("\\"));
        assertTrue(like(utf8Slice("\\abc%"), regex));
    }
View Full Code Here

    @Test
    public void testAlternateEscapedCharacters()
            throws Exception
    {
        Regex regex = likePattern(utf8Slice("xxx%x_xabcxx"), utf8Slice("x"));
        assertTrue(like(utf8Slice("x%_abcx"), regex));
    }
View Full Code Here

    {
        for (String value : stringLefts) {
            for (String pattern : stringLefts) {
                Boolean expected = null;
                if (value != null && pattern != null) {
                    Regex regex = LikeFunctions.likePattern(utf8Slice(pattern), utf8Slice("\\"));
                    expected = LikeFunctions.like(Slices.copiedBuffer(value, UTF_8), regex);
                }
                assertExecute(generateExpression("%s like %s", value, pattern), expected);
            }
        }
View Full Code Here

public class TestLikeUtils
{
    @Test(timeOut = 1000)
    public void testLikeUtf8Pattern()
    {
        Regex regex = LikeUtils.likeToPattern(utf8Slice("%\u540d\u8a89%"), utf8Slice("\\"));
        assertFalse(LikeUtils.regexMatches(regex, utf8Slice("foo")));
    }
View Full Code Here

    @Test(timeOut = 1000)
    public void testLikeInvalidUtf8Value()
    {
        Slice value = Slices.wrappedBuffer(new byte[] {'a', 'b', 'c', (byte) 0xFF, 'x', 'y'});
        Regex regex = LikeUtils.likeToPattern("%b%", '\\');
        assertTrue(LikeUtils.regexMatches(regex, value));
    }
View Full Code Here

    @Test
    public void testBackslashesNoSpecialTreatment()
            throws Exception
    {
        Regex regex = LikeUtils.likeToPattern("\\abc\\/\\\\");
        assertTrue(LikeUtils.regexMatches(regex, utf8Slice("\\abc\\/\\\\")));
    }
View Full Code Here

    @Test
    public void testSelfEscaping()
            throws Exception
    {
        Regex regex = LikeUtils.likeToPattern("\\\\abc\\%", '\\');
        assertTrue(LikeUtils.regexMatches(regex, utf8Slice("\\abc%")));
    }
View Full Code Here

    @Test
    public void testAlternateEscapedCharacters()
            throws Exception
    {
        Regex regex = LikeUtils.likeToPattern("xxx%x_xabcxx", 'x');
        assertTrue(LikeUtils.regexMatches(regex, utf8Slice("x%_abcx")));
    }
View Full Code Here

TOP

Related Classes of org.joni.Regex

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.