Package org.apache.commons.beanutils

Examples of org.apache.commons.beanutils.TestBean


    /**
     * Test copy properties where the target bean only
     * has an indexed setter.
     */
    public void testIssue_BEANUTILS_92_copyProperties_indexed_only_setter() throws Exception {
        PropertyUtils.copyProperties(new Jira92TestBean(), new TestBean());
    }
View Full Code Here


    /**
     * Test setting a nested simple property
     */
    public void testSetNestedPropertySimple() {
        TestBean bean = new TestBean();
        bean.getNested().setIntProperty(5);
        assertEquals("Initial value 5", 5, bean.getNested().getIntProperty());
        try {
            LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", null);
        } catch (Throwable t) {
            log.error(t);
            fail("Threw " + t);
        }
        assertEquals("Check Set Value", 123, bean.getNested().getIntProperty());
    }
View Full Code Here

    /**
     * Test setting a nested indexed property
     */
    public void testSetNestedPropertyIndexed() {
        TestBean bean = new TestBean();
        bean.getNested().setIntIndexed(1, 51);
        assertEquals("Initial value[1] 51", 51, bean.getNested().getIntIndexed(1));
        try {
            LocaleBeanUtils.setProperty(bean, "nested.intIndexed[1]", "123", null);
        } catch (Throwable t) {
            log.error(t);
            fail("Threw " + t);
        }
        assertEquals("Check Set Value", 123, bean.getNested().getIntIndexed(1));
    }
View Full Code Here

    /**
     * Test copy properties where the target bean only
     * has an indexed setter.
     */
    public void testIssue_BEANUTILS_92_copyProperties_indexed_only_setter() throws Exception {
        PropertyUtils.copyProperties(new Jira92TestBean(), new TestBean());
    }
View Full Code Here

    /**
     * Test setting a nested simple property
     */
    public void testSetNestedPropertySimple() {
        TestBean bean = new TestBean();
        bean.getNested().setIntProperty(5);
        assertEquals("Initial value 5", 5, bean.getNested().getIntProperty());
        try {
            LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", null);
        } catch (Throwable t) {
            log.error(t);
            fail("Threw " + t);
        }
        assertEquals("Check Set Value", 123, bean.getNested().getIntProperty());
    }
View Full Code Here

    /**
     * Test setting a nested indexed property
     */
    public void testSetNestedPropertyIndexed() {
        TestBean bean = new TestBean();
        bean.getNested().setIntIndexed(1, 51);
        assertEquals("Initial value[1] 51", 51, bean.getNested().getIntIndexed(1));
        try {
            LocaleBeanUtils.setProperty(bean, "nested.intIndexed[1]", "123", null);
        } catch (Throwable t) {
            log.error(t);
            fail("Threw " + t);
        }
        assertEquals("Check Set Value", 123, bean.getNested().getIntIndexed(1));
    }
View Full Code Here

    /**
     * Test copy properties where the target bean only
     * has an indexed setter.
     */
    public void testIssue_BEANUTILS_92_copyProperties_indexed_only_setter() throws Exception {
        PropertyUtils.copyProperties(new Jira92TestBean(), new TestBean());
    }
View Full Code Here

    /**
     * Test {@link PropertyUtils#getIndexedProperty(Object, String, int)}
     */
    public void testPropertyUtils_getIndexedProperty_Array() throws Exception {

        TestBean bean = new TestBean();
        try {
            PropertyUtils.getIndexedProperty(bean, "intArray", bean.getIntArray().length);
            fail("Expected ArrayIndexOutOfBoundsException");
        } catch (ArrayIndexOutOfBoundsException e) {
            // expected result
        }
    }
View Full Code Here

    /**
     * Test {@link PropertyUtils#getIndexedProperty(Object, String, int)}
     */
    public void testPropertyUtils_getIndexedProperty_List() throws Exception {

        TestBean bean = new TestBean();
        try {
            PropertyUtils.getIndexedProperty(bean, "listIndexed", bean.getListIndexed().size());
            fail("Expected IndexOutOfBoundsException");
        } catch (IndexOutOfBoundsException e) {
            // expected result
        }
    }
View Full Code Here

    /**
     * Test setting a nested simple property
     */
    public void testSetNestedPropertySimple() {
        TestBean bean = new TestBean();
        bean.getNested().setIntProperty(5);
        assertEquals("Initial value 5", 5, bean.getNested().getIntProperty());
        try {
            LocaleBeanUtils.setProperty(bean, "nested.intProperty", "123", null);
        } catch (Throwable t) {
            log.error(t);
            fail("Threw " + t);
        }
        assertEquals("Check Set Value", 123, bean.getNested().getIntProperty());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.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.