/* * 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(); }
/* * Test the setValue() method with a non-null value when the value of the * expression is still unbounded. */ public void testSetValue_UnboundNormal() 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(); }
/* * 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(); }