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.container.services.information;
07:
08: import org.apache.pluto.om.common.ObjectID;
09: import org.jasig.portal.container.om.common.ObjectIDImpl;
10:
11: import junit.framework.TestCase;
12:
13: /**
14: * Testcase for StaticInformationProviderImpl.
15: * Currently tests some argument checking on the getPortletDefinition() method.
16: */
17: public class StaticInformationProviderImplTest extends TestCase {
18:
19: /**
20: * Test that getPortletDefinition() throws IllegalArgumentException when
21: * invoked on a null argument.
22: */
23: public void testGetPortletDefForNullGuid() {
24: StaticInformationProviderImpl impl = new StaticInformationProviderImpl();
25:
26: try {
27: impl.getPortletDefinition(null);
28: } catch (IllegalArgumentException iae) {
29: // good. IllegalArgumentException expected
30: return;
31: }
32: fail("Should have thrown IllegalArgumentException.");
33: }
34:
35: /**
36: * Test that getPortletDefinition() throws IllegalArgumentException when
37: * invoked on a guid that doesn't contain the required '.' character.
38: */
39: public void testGetPortletDefForNoDotGuid() {
40: StaticInformationProviderImpl impl = new StaticInformationProviderImpl();
41: ObjectID objectId = ObjectIDImpl.createFromString("foo");
42:
43: try {
44: impl.getPortletDefinition(objectId);
45: } catch (IllegalArgumentException iae) {
46: // good. IllegalArgumentException expected
47: return;
48: }
49: fail("Should have thrown IllegalArgumentException.");
50: }
51:
52: }
|