01: /* Copyright 2005 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout.node;
07:
08: import org.jasig.portal.channels.BaseChannel;
09: import org.jasig.portal.channels.error.CError;
10: import org.jasig.portal.channels.portlet.CPortletAdapter;
11: import org.jasig.portal.channels.portlet.IPortletAdaptor;
12:
13: import junit.framework.TestCase;
14:
15: /**
16: * JUnit testcase for UserLayoutChannelDescription.
17: */
18: public class UserLayoutChannelDescriptionTest extends TestCase {
19:
20: protected void setUp() throws Exception {
21: super .setUp();
22: }
23:
24: protected void tearDown() throws Exception {
25: super .tearDown();
26: }
27:
28: public void testIsPortlet() {
29: // test that when channel class is not set
30: // channel description does not think it's a portlet
31: UserLayoutChannelDescription description = new UserLayoutChannelDescription();
32: assertFalse(description.isPortlet());
33:
34: // test that when channel class is set to a non-portlet IChannel
35: // channel description does not think its a portlet
36: description.setClassName(CError.class.getName());
37: assertFalse(description.isPortlet());
38:
39: // test that when channel class is set to a non-existing class
40: // implementation does not think it's a portlet
41: description.setClassName("not.a.real.package.DoesNotExist");
42: assertFalse(description.isPortlet());
43:
44: // test that when channel class is set to CPortletAdapter
45: // channel description thinks its a portlet
46: description.setClassName(CPortletAdapter.class.getName());
47: assertTrue(description.isPortlet());
48:
49: // test that when channel class is set to another IPortletAdaptor
50: // channel description thinks its a portlet
51: description.setClassName(AnotherPortletAdaptor.class.getName());
52: assertTrue(description.isPortlet());
53: }
54:
55: /**
56: * Test class used to test recognition of non-CPortletAdaptor
57: * IPortletAdaptors.
58: */
59: private class AnotherPortletAdaptor extends BaseChannel implements
60: IPortletAdaptor {
61:
62: }
63:
64: }
|