Package com.vaadin.data.util.filter

Examples of com.vaadin.data.util.filter.Like


        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_containsLikeQueryOnStringContainingValueCaseInsensitive_shouldSucceed() {
        Like like = new Like("test", "%foo%");
        like.setCaseSensitive(false);

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("asdfOOghij"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here


        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_containsLikeQueryOnStringContainingValueConstructedCaseInsensitive_shouldSucceed() {
        Like like = new Like("test", "%foo%", false);

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("asdfOOghij"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_containsLikeQueryOnStringNotContainingValue_shouldFail() {
        Like like = new Like("test", "%foo%");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("asdbarghij"));

        Assert.assertFalse(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertFalse(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_containsLikeQueryOnStringExactlyEqualToValue_shouldSucceed() {
        Like like = new Like("test", "%foo%");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("foo"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_containsLikeQueryOnStringEqualToValueMinusOneCharAtTheEnd_shouldFail() {
        Like like = new Like("test", "%foo%");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("fo"));

        Assert.assertFalse(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertFalse(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_beginsWithLikeQueryOnStringBeginningWithValue_shouldSucceed() {
        Like like = new Like("test", "foo%");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("foobar"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_beginsWithLikeQueryOnStringNotBeginningWithValue_shouldFail() {
        Like like = new Like("test", "foo%");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("barfoo"));

        Assert.assertFalse(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertFalse(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_endsWithLikeQueryOnStringEndingWithValue_shouldSucceed() {
        Like like = new Like("test", "%foo");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("barfoo"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertTrue(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_endsWithLikeQueryOnStringNotEndingWithValue_shouldFail() {
        Like like = new Like("test", "%foo");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("foobar"));

        Assert.assertFalse(like.passesFilter("id", item));
    }
View Full Code Here

        Assert.assertFalse(like.passesFilter("id", item));
    }

    @Test
    public void passesFilter_startsWithAndEndsWithOnMatchingValue_shouldSucceed() {
        Like like = new Like("test", "foo%bar");

        Item item = new PropertysetItem();
        item.addItemProperty("test", new ObjectProperty<String>("fooASDFbar"));

        Assert.assertTrue(like.passesFilter("id", item));
    }
View Full Code Here

TOP

Related Classes of com.vaadin.data.util.filter.Like

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.