1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.providers.cas.proxy;
17
18 import java.util.List;
19 import java.util.Vector;
20
21 import junit.framework.TestCase;
22
23 import org.acegisecurity.providers.cas.ProxyUntrustedException;
24
25
26 /***
27 * Tests {@link RejectProxyTickets}.
28 *
29 * @author Ben Alex
30 * @version $Id: RejectProxyTicketsTests.java,v 1.4 2005/11/30 01:23:34 benalex Exp $
31 */
32 public class RejectProxyTicketsTests extends TestCase {
33
34
35 public RejectProxyTicketsTests() {
36 super();
37 }
38
39 public RejectProxyTicketsTests(String arg0) {
40 super(arg0);
41 }
42
43
44
45 public final void setUp() throws Exception {
46 super.setUp();
47 }
48
49 public static void main(String[] args) {
50 junit.textui.TestRunner.run(RejectProxyTicketsTests.class);
51 }
52
53 public void testAcceptsIfNoProxiesInTicket() {
54 RejectProxyTickets proxyDecider = new RejectProxyTickets();
55 List proxyList = new Vector();
56
57 proxyDecider.confirmProxyListTrusted(proxyList);
58 assertTrue(true);
59 }
60
61 public void testDoesNotAcceptNull() {
62 RejectProxyTickets proxyDecider = new RejectProxyTickets();
63
64 try {
65 proxyDecider.confirmProxyListTrusted(null);
66 fail("Should have thrown IllegalArgumentException");
67 } catch (IllegalArgumentException expected) {
68 assertEquals("proxyList cannot be null", expected.getMessage());
69 }
70 }
71
72 public void testRejectsIfAnyProxyInList() {
73 RejectProxyTickets proxyDecider = new RejectProxyTickets();
74 List proxyList = new Vector();
75 proxyList.add("https://localhost/webApp/j_acegi_cas_security_check");
76
77 try {
78 proxyDecider.confirmProxyListTrusted(proxyList);
79 fail("Should have thrown ProxyUntrustedException");
80 } catch (ProxyUntrustedException expected) {
81 assertTrue(true);
82 }
83 }
84 }