1 15 package org.apache.tapestry.portlet; 16 17 import java.util.List ; 18 19 import javax.portlet.PortletConfig; 20 21 import org.easymock.MockControl; 22 23 29 public class TestPortletWebActivator extends BasePortletWebTestCase 30 { 31 public void testGetActivatorName() 32 { 33 MockControl control = newControl(PortletConfig.class); 34 PortletConfig config = (PortletConfig) control.getMock(); 35 36 config.getPortletName(); 37 control.setReturnValue("portlet"); 38 39 replayControls(); 40 41 PortletWebActivator pwa = new PortletWebActivator(config); 42 43 assertEquals("portlet", pwa.getActivatorName()); 44 45 verifyControls(); 46 } 47 48 public void testGetInitParameterNames() 49 { 50 MockControl control = newControl(PortletConfig.class); 51 PortletConfig config = (PortletConfig) control.getMock(); 52 53 config.getInitParameterNames(); 54 control.setReturnValue(newEnumeration()); 55 56 replayControls(); 57 58 PortletWebActivator pwa = new PortletWebActivator(config); 59 60 List l = pwa.getInitParameterNames(); 61 62 checkList(l); 63 64 verifyControls(); 65 } 66 67 public void testGetInitParameterValue() 68 { 69 String value = "William Orbit"; 70 71 MockControl control = newControl(PortletConfig.class); 72 PortletConfig config = (PortletConfig) control.getMock(); 73 74 config.getInitParameter("artist"); 75 control.setReturnValue(value); 76 77 replayControls(); 78 79 PortletWebActivator pwa = new PortletWebActivator(config); 80 81 assertSame(value, pwa.getInitParameterValue("artist")); 82 83 verifyControls(); 84 } 85 } | Popular Tags |