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
22 import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
23
24 import org.acegisecurity.util.SimpleMethodInvocation;
25
26
27
28
29
30
31
32
33 public class AuthorizedEventTests extends TestCase {
34
35
36 public AuthorizedEventTests() {
37 super();
38 }
39
40 public AuthorizedEventTests(String arg0) {
41 super(arg0);
42 }
43
44
45
46 public static void main(String[] args) {
47 junit.textui.TestRunner.run(AuthorizedEventTests.class);
48 }
49
50 public void testRejectsNulls() {
51 try {
52 new AuthorizedEvent(null, new ConfigAttributeDefinition(),
53 new UsernamePasswordAuthenticationToken("foo", "bar"));
54 fail("Should have thrown IllegalArgumentException");
55 } catch (IllegalArgumentException expected) {
56 assertTrue(true);
57 }
58
59 try {
60 new AuthorizedEvent(new SimpleMethodInvocation(), null,
61 new UsernamePasswordAuthenticationToken("foo", "bar"));
62 fail("Should have thrown IllegalArgumentException");
63 } catch (IllegalArgumentException expected) {
64 assertTrue(true);
65 }
66
67 try {
68 new AuthorizedEvent(new SimpleMethodInvocation(), new ConfigAttributeDefinition(), null);
69 fail("Should have thrown IllegalArgumentException");
70 } catch (IllegalArgumentException expected) {
71 assertTrue(true);
72 }
73 }
74 }