    1   package org.acegisecurity.ui.x509;
    2
    3   import junit.framework.TestCase;
    4
    5   import org.acegisecurity.BadCredentialsException;
    6   import org.springframework.mock.web.MockHttpServletRequest;
    7   import org.springframework.mock.web.MockHttpServletResponse;
    8
    9   import javax.servlet.http.HttpServletResponse;
    10
    11
    12  /***
    13   * Tests {@link X509ProcessingFilterEntryPoint}.
    14   *
    15   * @author Luke Taylor
    16   * @version $Id: X509ProcessingFilterEntryPointTests.java,v 1.2 2005/11/17 00:55:49 benalex Exp $
    17   */
    18  public class X509ProcessingFilterEntryPointTests extends TestCase {
    19      //~ Constructors ===========================================================
    20
    21      public X509ProcessingFilterEntryPointTests() {
    22          super();
    23      }
    24
    25      public X509ProcessingFilterEntryPointTests(String arg0) {
    26          super(arg0);
    27      }
    28
    29      //~ Methods ================================================================
    30
    31      public final void setUp() throws Exception {
    32          super.setUp();
    33      }
    34
    35      public void testNormalOperation() throws Exception {
    36          MockHttpServletRequest request = new MockHttpServletRequest();
    37          MockHttpServletResponse response = new MockHttpServletResponse();
    38          X509ProcessingFilterEntryPoint entryPoint = new X509ProcessingFilterEntryPoint();
    39
    40          entryPoint.commence(request, response, new BadCredentialsException("As thrown by security enforcement filter"));
    41          assertEquals(HttpServletResponse.SC_FORBIDDEN, response.getStatus());
    42
    43      }
    44  }