KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > portlet > TestPortletWebActivator


1 // Copyright 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.portlet;
16
17 import java.util.List JavaDoc;
18
19 import javax.portlet.PortletConfig;
20
21 import org.easymock.MockControl;
22
23 /**
24  * Tests for {@link org.apache.tapestry.portlet.PortletWebActivator}.
25  *
26  * @author Howard M. Lewis Ship
27  * @since 4.0
28  */

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 JavaDoc l = pwa.getInitParameterNames();
61
62         checkList(l);
63
64         verifyControls();
65     }
66
67     public void testGetInitParameterValue()
68     {
69         String JavaDoc 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