01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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:
16: package org.acegisecurity.runas;
17:
18: import junit.framework.TestCase;
19:
20: import org.acegisecurity.SecurityConfig;
21:
22: /**
23: * Tests {@link NullRunAsManager}.
24: *
25: * @author Ben Alex
26: * @version $Id: NullRunAsManagerTests.java 1496 2006-05-23 13:38:33Z benalex $
27: */
28: public class NullRunAsManagerTests extends TestCase {
29: //~ Constructors ===================================================================================================
30:
31: public NullRunAsManagerTests() {
32: super ();
33: }
34:
35: public NullRunAsManagerTests(String arg0) {
36: super (arg0);
37: }
38:
39: //~ Methods ========================================================================================================
40:
41: public static void main(String[] args) {
42: junit.textui.TestRunner.run(NullRunAsManagerTests.class);
43: }
44:
45: public final void setUp() throws Exception {
46: super .setUp();
47: }
48:
49: public void testAlwaysReturnsNull() {
50: NullRunAsManager runAs = new NullRunAsManager();
51: assertNull(runAs.buildRunAs(null, null, null));
52: }
53:
54: public void testAlwaysSupportsClass() {
55: NullRunAsManager runAs = new NullRunAsManager();
56: assertTrue(runAs.supports(String.class));
57: }
58:
59: public void testNeverSupportsAttribute() {
60: NullRunAsManager runAs = new NullRunAsManager();
61: assertFalse(runAs.supports(new SecurityConfig("X")));
62: }
63: }
|