Package org.apache.cayenne.unit.util

Examples of org.apache.cayenne.unit.util.TestBean


    public void testOrderList2() throws Exception {
        // compare on non-persistent property
        List list = new ArrayList(3);

        list.add(new TestBean(5));
        list.add(new TestBean(2));
        list.add(new TestBean(3));

        new Ordering("integer", SortOrder.ASCENDING).orderList(list);
        assertEquals(2, ((TestBean) list.get(0)).getInteger().intValue());
        assertEquals(3, ((TestBean) list.get(1)).getInteger().intValue());
        assertEquals(5, ((TestBean) list.get(2)).getInteger().intValue());
View Full Code Here


    public void testOrderListWithMultipleOrderings2() throws Exception {
        // compare on non-persistent property
        List list = new ArrayList(6);

        list.add(new TestBean("c", 1));
        list.add(new TestBean("c", 30));
        list.add(new TestBean("a", 5));
        list.add(new TestBean("b", 1));
        list.add(new TestBean("b", 2));
        list.add(new TestBean("b", 5));

        List orderings = new ArrayList(2);
        orderings.add(new Ordering("string", SortOrder.ASCENDING));
        orderings.add(new Ordering("integer", SortOrder.DESCENDING));
View Full Code Here

        assertSame(object, a.readNestedProperty("someOtherObjectProperty"));
    }

    public void testReadNestedPropertyNonDataObjectPath() {
        CayenneDataObject o1 = new CayenneDataObject();
        TestBean o2 = new TestBean();
        o2.setInteger(new Integer(55));
        o1.writePropertyDirectly("o2", o2);

        assertSame(o2, o1.readNestedProperty("o2"));
        assertEquals(new Integer(55), o1.readNestedProperty("o2.integer"));
        assertEquals(TestBean.class, o1.readNestedProperty("o2.class"));
View Full Code Here

    }

    public void testEvaluateOBJ_PATH_JavaBean() throws Exception {
        ASTObjPath node = new ASTObjPath("property2");

        TestBean b1 = new TestBean();
        b1.setProperty2(1);
        assertEquals(new Integer(1), node.evaluate(b1));

        TestBean b2 = new TestBean();
        b2.setProperty2(-3);
        assertEquals(new Integer(-3), node.evaluate(b2));
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.unit.util.TestBean

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.