Package org.apache.harmony.beans.tests.support

Examples of org.apache.harmony.beans.tests.support.SampleBean


    public void testConstructor() throws Exception {
        Expression expr = new Expression(SampleBean.class, "new",
                new Object[] { "hello" });
        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
        } else {
            fail("Cannot instantiate an instance of Bean class.");
        }
    }
View Full Code Here


    /**
     * The test checks the correct static method is initialized
     */
    public void testStatic() throws Exception {
        SampleBean theBean = new SampleBean();
        Expression expr = new Expression(SampleBean.class, "create",
                new Object[] { "hello", theBean });

        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
            assertEquals(theBean, bean.getObject());
        } else {
            fail("Cannot instantiate an instance of Bean class by "
                    + "static method.");
        }
    }
View Full Code Here

    /**
     * The test checks the correct getter is initialized
     */
    public void testGetter() throws Exception {
        Expression expr = new Expression(new SampleBean("hello"), "getText",
                new Object[] {});

        Object result = expr.getValue();
        if (result != null && result instanceof String) {
            assertEquals("hello", result);
View Full Code Here

    public void testLoadBySpecificClassLoader() throws Exception {
        String beanName = "org.apache.harmony.beans.tests.support.SampleBean";

        ClassLoader cls = createSpecificClassLoader();
        Object bean = Beans.instantiate(cls, beanName);
        SampleBean sampleBean;

        assertNotNull(bean);
        assertEquals(bean.getClass(), SampleBean.class);

        sampleBean = (SampleBean) bean;
        assertNull(sampleBean.getText());
    }
View Full Code Here

     */
    public void testLoadByDefaultClassLoader() throws Exception {
        String beanName = "org.apache.harmony.beans.tests.support.SampleBean";

        Object bean = Beans.instantiate(null, beanName);
        SampleBean sampleBean;

        assertNotNull(bean);
        assertEquals(bean.getClass(), SampleBean.class);

        sampleBean = (SampleBean) bean;
        assertNull(sampleBean.getText());
    }
View Full Code Here

    public void testConstructor() throws Exception {
        Expression expr = new Expression(SampleBean.class, "new",
                new Object[] { "hello" });
        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
        } else {
            fail("Cannot instantiate an instance of Bean class.");
        }
    }
View Full Code Here

    /**
     * The test checks the correct static method is initialized
     */
    public void testStatic() throws Exception {
        SampleBean theBean = new SampleBean();
        Expression expr = new Expression(SampleBean.class, "create",
                new Object[] { "hello", theBean });

        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
            assertEquals(theBean, bean.getObject());
        } else {
            fail("Cannot instantiate an instance of Bean class by "
                    + "static method.");
        }
    }
View Full Code Here

    /**
     * The test checks the correct getter is initialized
     */
    public void testGetter() throws Exception {
        Expression expr = new Expression(new SampleBean("hello"), "getText",
                new Object[] {});

        Object result = expr.getValue();
        if (result != null && result instanceof String) {
            assertEquals("hello", result);
View Full Code Here

    public void testConstructor() throws Exception {
        Expression expr = new Expression(SampleBean.class, "new",
                new Object[] { "hello" });
        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
        } else {
            fail("Cannot instantiate an instance of Bean class.");
        }
    }
View Full Code Here

    /**
     * The test checks the correct static method is initialized
     */
    public void testStatic() throws Exception {
        SampleBean theBean = new SampleBean();
        Expression expr = new Expression(SampleBean.class, "create",
                new Object[] { "hello", theBean });

        Object result = expr.getValue();
        if (result != null && result instanceof SampleBean) {
            SampleBean bean = (SampleBean) result;
            assertEquals("hello", bean.getText());
            assertEquals(theBean, bean.getObject());
        } else {
            fail("Cannot instantiate an instance of Bean class by "
                    + "static method.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.beans.tests.support.SampleBean

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.