1   /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * 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.providers.cas.proxy;
17  
18  import junit.framework.TestCase;
19  
20  import java.util.Vector;
21  
22  
23  /**
24   * Tests {@link AcceptAnyCasProxy}.
25   *
26   * @author Ben Alex
27   * @version $Id: AcceptAnyCasProxyTests.java 1496 2006-05-23 13:38:33Z benalex $
28   */
29  public class AcceptAnyCasProxyTests extends TestCase {
30      //~ Constructors ===================================================================================================
31  
32      public AcceptAnyCasProxyTests() {
33          super();
34      }
35  
36      public AcceptAnyCasProxyTests(String arg0) {
37          super(arg0);
38      }
39  
40      //~ Methods ========================================================================================================
41  
42      public static void main(String[] args) {
43          junit.textui.TestRunner.run(AcceptAnyCasProxyTests.class);
44      }
45  
46      public final void setUp() throws Exception {
47          super.setUp();
48      }
49  
50      public void testDoesNotAcceptNull() {
51          AcceptAnyCasProxy proxyDecider = new AcceptAnyCasProxy();
52  
53          try {
54              proxyDecider.confirmProxyListTrusted(null);
55              fail("Should have thrown IllegalArgumentException");
56          } catch (IllegalArgumentException expected) {
57              assertEquals("proxyList cannot be null", expected.getMessage());
58          }
59      }
60  
61      public void testNormalOperation() {
62          AcceptAnyCasProxy proxyDecider = new AcceptAnyCasProxy();
63          proxyDecider.confirmProxyListTrusted(new Vector());
64          assertTrue(true); // as no Exception thrown
65      }
66  }