1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.event.authorization;
17
18 import junit.framework.TestCase;
19
20 import org.acegisecurity.ConfigAttributeDefinition;
21 import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
22 import org.acegisecurity.util.SimpleMethodInvocation;
23
24
25 /***
26 * Tests {@link AuthorizedEvent}.
27 *
28 * @author Ben Alex
29 * @version $Id: AuthorizedEventTests.java,v 1.3 2005/11/25 04:17:24 benalex Exp $
30 */
31 public class AuthorizedEventTests extends TestCase {
32
33
34 public AuthorizedEventTests() {
35 super();
36 }
37
38 public AuthorizedEventTests(String arg0) {
39 super(arg0);
40 }
41
42
43
44 public static void main(String[] args) {
45 junit.textui.TestRunner.run(AuthorizedEventTests.class);
46 }
47
48 public void testRejectsNulls() {
49 try {
50 new AuthorizedEvent(null, new ConfigAttributeDefinition(),
51 new UsernamePasswordAuthenticationToken("foo", "bar"));
52 fail("Should have thrown IllegalArgumentException");
53 } catch (IllegalArgumentException expected) {
54 assertTrue(true);
55 }
56
57 try {
58 new AuthorizedEvent(new SimpleMethodInvocation(), null,
59 new UsernamePasswordAuthenticationToken("foo", "bar"));
60 fail("Should have thrown IllegalArgumentException");
61 } catch (IllegalArgumentException expected) {
62 assertTrue(true);
63 }
64
65 try {
66 new AuthorizedEvent(new SimpleMethodInvocation(),
67 new ConfigAttributeDefinition(), null);
68 fail("Should have thrown IllegalArgumentException");
69 } catch (IllegalArgumentException expected) {
70 assertTrue(true);
71 }
72 }
73 }