1 15 package org.apache.tapestry.binding; 16 17 import org.apache.hivemind.Location; 18 import org.apache.tapestry.IActionListener; 19 import org.apache.tapestry.IComponent; 20 import org.apache.tapestry.coerce.ValueConverter; 21 import org.apache.tapestry.listener.ListenerMap; 22 import org.easymock.MockControl; 23 24 30 public class TestListenerMethodBinding extends BindingTestCase 31 { 32 public void testGetObject() 33 { 34 MockControl cc = newControl(IComponent.class); 35 IComponent component = (IComponent) cc.getMock(); 36 37 MockControl lmc = newControl(ListenerMap.class); 38 ListenerMap lm = (ListenerMap) lmc.getMock(); 39 40 IActionListener listener = (IActionListener) newMock(IActionListener.class); 41 42 component.getListeners(); 43 cc.setReturnValue(lm); 44 45 lm.getListener("foo"); 46 lmc.setReturnValue(listener); 47 48 ValueConverter vc = newValueConverter(); 49 50 Location l = newLocation(); 51 52 replayControls(); 53 54 ListenerMethodBinding b = new ListenerMethodBinding(component, "foo", "param", vc, l); 55 56 assertSame(listener, b.getObject()); 57 assertSame(component, b.getComponent()); 58 59 verifyControls(); 60 } 61 } | Popular Tags |