Package org.pirkaengine.core

Examples of org.pirkaengine.core.Item


    @Test
    public void eval_getter() {
        Category category = new Category();
        category.id = 10;
        Item item = new Item();
        item.name = "名称";
        item.category = category;
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("名称", target.eval("item.name", model));
        Assert.assertEquals("10", target.eval("item.category.id", model));
View Full Code Here


        Assert.assertEquals("10", target.eval("item.category.id", model));
    }

    @Test
    public void eval_getter_null() {
        Item item = new Item();
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("", target.eval("item.nullValue", model));
    }
View Full Code Here

        Assert.assertEquals("", target.eval("item.nullValue", model));
    }

    @Test
    public void eval_public_property() {
        Item item = new Item();
        item.price = 3500;
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("3,500", target.eval("item.labeledPrice", model));
    }
View Full Code Here

        Assert.assertEquals("3,500", target.eval("item.labeledPrice", model));
    }

    @Test
    public void eval_public_property_null() {
        Item item = new Item();
        item.name = null;
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("", target.eval("item.name", model));
    }
View Full Code Here

        Assert.assertEquals("", target.eval("item.name", model));
    }

    @Test
    public void eval_public_method() {
        Item item = new Item();
        item.id = 1;
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("1", target.eval("item.id", model));
    }
View Full Code Here

        Assert.assertEquals("1", target.eval("item.id", model));
    }

    @Test
    public void eval_public_method_null() {
        Item item = new Item();
        HashMap<String, Object> model = getModel("item", item);
        Assert.assertEquals("", target.eval("item.methodNull", model));
    }
View Full Code Here

        Assert.assertEquals("3500", target.eval("item.price", model));
    }

    @Test(expected = EvalException.class)
    public void eval_public_none_property() {
        Item item = new Item();
        HashMap<String, Object> model = getModel("item", item);
        target.eval("item.xx", model);
    }
View Full Code Here

        target.eval("item.xx", model);
    }

    @Test(expected = EvalException.class)
    public void eval_private_property() {
        Item item = new Item();
        HashMap<String, Object> model = getModel("item", item);
        target.eval("item.privateValue", model);
    }
View Full Code Here

        target.eval("item.privateValue", model);
    }

    @Test(expected = EvalException.class)
    public void eval_private_getter() {
        Item item = new Item();
        HashMap<String, Object> model = getModel("item", item);
        target.eval("item.privateValue", model);
    }
View Full Code Here

    }

    @Test
    public void evalBoolean_objectField() {
        HashMap<String, Object> model = new HashMap<String, Object>();
        Item item = new Item();
        item.sale = true;
        model.put("foo", item);
        assertThat(target.evalBoolean("foo.sale", model), is(true));
    }
View Full Code Here

TOP

Related Classes of org.pirkaengine.core.Item

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.