Package com.vaadin.data.util

Examples of com.vaadin.data.util.PropertysetItem


public class CaseInsensitiveBinding {

    @Test
    public void caseInsensitivityAndUnderscoreRemoval() {
        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("LastName", new ObjectProperty<String>("Sparrow"));

        class MyForm extends FormLayout {
            TextField lastName = new TextField("Last name");

            public MyForm() {
View Full Code Here


        assertTrue("Sparrow".equals(form.lastName.getValue()));
    }

    @Test
    public void UnderscoreRemoval() {
        PropertysetItem item = new PropertysetItem();
        item.addItemProperty("first_name", new ObjectProperty<String>("Jack"));

        class MyForm extends FormLayout {
            TextField firstName = new TextField("First name");

            public MyForm() {
View Full Code Here

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

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

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

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

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

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

    @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

    @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

    @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

    @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

    @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

    @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

TOP

Related Classes of com.vaadin.data.util.PropertysetItem

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.