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.event.authorization;
17:
18: import junit.framework.TestCase;
19:
20: import org.acegisecurity.AuthenticationCredentialsNotFoundException;
21: import org.acegisecurity.ConfigAttributeDefinition;
22:
23: import org.acegisecurity.util.SimpleMethodInvocation;
24:
25: /**
26: * Tests {@link AuthenticationCredentialsNotFoundEvent}.
27: *
28: * @author Ben Alex
29: * @version $Id: AuthenticationCredentialsNotFoundEventTests.java 1496 2006-05-23 13:38:33Z benalex $
30: */
31: public class AuthenticationCredentialsNotFoundEventTests extends
32: TestCase {
33: //~ Constructors ===================================================================================================
34:
35: public AuthenticationCredentialsNotFoundEventTests() {
36: super ();
37: }
38:
39: public AuthenticationCredentialsNotFoundEventTests(String arg0) {
40: super (arg0);
41: }
42:
43: //~ Methods ========================================================================================================
44:
45: public static void main(String[] args) {
46: junit.textui.TestRunner
47: .run(AuthenticationCredentialsNotFoundEventTests.class);
48: }
49:
50: public void testRejectsNulls() {
51: try {
52: new AuthenticationCredentialsNotFoundEvent(null,
53: new ConfigAttributeDefinition(),
54: new AuthenticationCredentialsNotFoundException(
55: "test"));
56: fail("Should have thrown IllegalArgumentException");
57: } catch (IllegalArgumentException expected) {
58: assertTrue(true);
59: }
60:
61: try {
62: new AuthenticationCredentialsNotFoundEvent(
63: new SimpleMethodInvocation(), null,
64: new AuthenticationCredentialsNotFoundException(
65: "test"));
66: fail("Should have thrown IllegalArgumentException");
67: } catch (IllegalArgumentException expected) {
68: assertTrue(true);
69: }
70:
71: try {
72: new AuthenticationCredentialsNotFoundEvent(
73: new SimpleMethodInvocation(),
74: new ConfigAttributeDefinition(), null);
75: fail("Should have thrown IllegalArgumentException");
76: } catch (IllegalArgumentException expected) {
77: assertTrue(true);
78: }
79: }
80: }
|