Package java.beans

Examples of java.beans.Expression


     * Test the setValue() method when the value of the expression is set by the
     * constructor.
     */
    public void testSetValue_Constructor() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, mo, "method", new Object[0]);
        assertSame(mo, t.getValue());
        MockObject.assertNotCalled();
        t.setValue(null);
        assertSame(null, t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here


     * Test the setValue() method when the value of the expression is set by a
     * previous call to setValue().
     */
    public void testSetValue_Set() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[0]);
        t.setValue(mo);
        assertSame(mo, t.getValue());
        MockObject.assertNotCalled();
        t.setValue(null);
        assertSame(null, t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here

     * Test the setValue() method when the value of the expression is set by a
     * previous call to getValue().
     */
    public void testSetValue_Evaluated() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[0]);
        assertEquals("method1", t.getValue());
        MockObject.assertCalled("method1", new Object[0]);
        t.setValue(mo);
        assertSame(mo, t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here

     * Test the getValue() method when the value of the expression is evaluated
     * by a previous call to getValue().
     */
    public void testGetValue_Evaluated() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[0]);
        assertEquals("method1", t.getValue());
        MockObject.assertCalled("method1", new Object[0]);
        assertEquals("method1", t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here

     * Test the getValue() method when the value of expression is set by the
     * constructor.
     */
    public void testGetValue_Constructor() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, mo, "method", new Object[0]);
        assertSame(mo, t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here

     * Test the getValue() method when the value of expression is set by a
     * previous call to setValue().
     */
    public void testGetValue_Set() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[0]);
        t.setValue(mo);
        assertSame(mo, t.getValue());
        MockObject.assertNotCalled();
    }
View Full Code Here

     * Test the method getValue() with a normal object, a valid method name and
     * valid arguments.
     */
    public void testGetValue_UnboundedNormalInstanceMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[0]);
        assertEquals("method1", t.getValue());
        MockObject.assertCalled("method1", new Object[0]);
        t = new Expression(mo, "method", null);
        assertEquals("method1", t.getValue());
        MockObject.assertCalled("method1", new Object[0]);
    }
View Full Code Here

     * Test the method getValue() with a normal object, a valid method that
     * throws an exception and valid arguments.
     */
    public void testGetValue_UnboundedExceptionalMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method", new Object[] { null, null });
        try {
            t.getValue();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
        MockObject.assertCalled("method4", new Object[] { null, null });
View Full Code Here

     * Test the method getValue() with a normal object and a non-existing method
     * name.
     */
    public void testGetValue_UnboundedNonExistingMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Expression t = new Expression(mo, "method_not_existing", new Object[] {
                null, null });
        try {
            t.getValue();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

    /*
     * Test the method getValue() with a null object.
     */
    public void testGetValue_UnboundedNullTarget() throws Exception {
        Expression t = new Expression(null, "method_not_existing",
                new Object[] { null, null });
        try {
            t.getValue();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
    }
View Full Code Here

TOP

Related Classes of java.beans.Expression

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.