Package org.apache.tapestry

Examples of org.apache.tapestry.PropertyConduit


    }

    @Test
    public void question_dot_operator_for_object_type()
    {
        PropertyConduit normal = _source.create(CompositeBean.class, "simple.firstName");
        PropertyConduit smart = _source.create(CompositeBean.class, "simple?.firstName");

        CompositeBean bean = new CompositeBean();
        bean.setSimple(null);

        try
        {
            normal.get(bean);
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        assertNull(smart.get(bean));

        try
        {
            normal.set(bean, "Howard");
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        // This will be a no-op due to the null property in the expression

        smart.set(bean, "Howard");
    }
View Full Code Here


        assertTrue(simple instanceof Serializable);

        simple.setFirstName("Howard");

        PropertyConduit conduit = _source.create(proxyClass, "firstName");

        assertEquals(conduit.get(simple), "Howard");
    }
View Full Code Here

    }

    @Test
    public void default_order_no_annotation()
    {
        PropertyConduit conduit = mockPropertyConduit();

        train_getAnnotation(conduit, Order.class, null);

        replay();
View Full Code Here

    }

    @Test
    public void default_order_with_annotation()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Order order = newMock(Order.class);

        train_getAnnotation(conduit, Order.class, order);

        expect(order.value()).andReturn(99);
View Full Code Here

        notNull(rootClass, "rootClass");
        notBlank(expression, "expression");

        MultiKey key = new MultiKey(rootClass, expression);

        PropertyConduit result = _cache.get(key);

        if (result == null)
        {
            result = build(rootClass, expression);
            _cache.put(key, result);
View Full Code Here

    @Test
    // Tests TAPESTRY-2182.
    public void test_null_pointer_exception_message()
    {
        final PropertyConduit conduit = mockPropertyConduit();
        final PropertyModel model = mockPropertyModel();
        final Object object = new Object();

        propertyOutputFixture.inject(model, object);

        expect(model.getConduit()).andReturn(conduit);
        expect(conduit.get(object)).andThrow(new NullPointerException());
        expect(model.getPropertyName()).andReturn("wilma.occupation.address");

        replay();

        try
View Full Code Here

    }

    @Test
    public void question_dot_operator_for_object_type()
    {
        PropertyConduit normal = _source.create(CompositeBean.class, "simple.firstName");
        PropertyConduit smart = _source.create(CompositeBean.class, "simple?.firstName");

        CompositeBean bean = new CompositeBean();
        bean.setSimple(null);

        try
        {
            normal.get(bean);
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        assertNull(smart.get(bean));

        try
        {
            normal.set(bean, "Howard");
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        // This will be a no-op due to the null property in the expression

        smart.set(bean, "Howard");
    }
View Full Code Here

    }

    @Test
    public void method_names_are_matched_caselessly()
    {
        PropertyConduit conduit = _source.create(CompositeBean.class, "GETSIMPLE().firstName");

        CompositeBean bean = new CompositeBean();
        SimpleBean inner = new SimpleBean();
        bean.setSimple(inner);

        conduit.set(bean, "Howard");

        assertEquals(inner.getFirstName(), "Howard");
    }
View Full Code Here

        assertTrue(simple instanceof Serializable);

        simple.setFirstName("Howard");

        PropertyConduit conduit = _source.create(proxyClass, "firstName");

        assertEquals(conduit.get(simple), "Howard");
    }
View Full Code Here

        StringHolder stringHolder = new StringHolder();
        stringHolder.put(string);
        StringHolderBean bean = new StringHolderBean();
        bean.setValue(stringHolder);

        PropertyConduit conduit = _source.create(StringHolderBean.class, "value.get()");

        assertSame(conduit.get(bean), string);

        assertSame(conduit.getPropertyType(), String.class);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.PropertyConduit

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.