1 15 package org.apache.tapestry.binding; 16 17 import org.apache.hivemind.Location; 18 import org.apache.hivemind.test.HiveMindTestCase; 19 import org.apache.tapestry.IBeanProvider; 20 import org.apache.tapestry.IComponent; 21 import org.apache.tapestry.coerce.ValueConverter; 22 import org.easymock.MockControl; 23 24 27 public class TestBeanBinding extends HiveMindTestCase 28 { 29 public void testCreate() 30 { 31 ValueConverter vc = (ValueConverter) newMock(ValueConverter.class); 32 33 MockControl componentc = newControl(IComponent.class); 34 IComponent component = (IComponent) componentc.getMock(); 35 36 MockControl beanProviderc = newControl(IBeanProvider.class); 37 IBeanProvider beanProvider = (IBeanProvider) beanProviderc.getMock(); 38 39 Location l = fabricateLocation(21); 40 41 Object bean = new Object (); 42 43 component.getBeans(); 44 componentc.setReturnValue(beanProvider); 45 46 beanProvider.getBean("fred"); 47 beanProviderc.setReturnValue(bean); 48 49 replayControls(); 50 51 BeanBinding binding = new BeanBinding("param", vc, l, component, "fred"); 52 53 assertSame(bean, binding.getObject()); 54 55 verifyControls(); 56 57 assertSame(component, binding.getComponent()); 58 assertSame(l, binding.getLocation()); 59 assertEquals("param", binding.getDescription()); 60 } 61 62 } | Popular Tags |