From 2a6c68deb6a6fa35a72fb812861a890efa51910f Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Fri, 18 Mar 2005 00:52:23 +0000 Subject: [PATCH] Entry point tests --- .../X509ProcessingFilterEntryPointTests.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 core/src/test/java/org/acegisecurity/ui/x509/X509ProcessingFilterEntryPointTests.java diff --git a/core/src/test/java/org/acegisecurity/ui/x509/X509ProcessingFilterEntryPointTests.java b/core/src/test/java/org/acegisecurity/ui/x509/X509ProcessingFilterEntryPointTests.java new file mode 100644 index 0000000000..c43e92a3f4 --- /dev/null +++ b/core/src/test/java/org/acegisecurity/ui/x509/X509ProcessingFilterEntryPointTests.java @@ -0,0 +1,44 @@ +package net.sf.acegisecurity.ui.x509; + +import junit.framework.TestCase; + +import net.sf.acegisecurity.BadCredentialsException; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; + +import javax.servlet.http.HttpServletResponse; + + +/** + * Tests {@link X509ProcessingFilterEntryPoint}. + * + * @author Luke Taylor + * @version $Id$ + */ +public class X509ProcessingFilterEntryPointTests extends TestCase { + //~ Constructors =========================================================== + + public X509ProcessingFilterEntryPointTests() { + super(); + } + + public X509ProcessingFilterEntryPointTests(String arg0) { + super(arg0); + } + + //~ Methods ================================================================ + + public final void setUp() throws Exception { + super.setUp(); + } + + public void testNormalOperation() throws Exception { + MockHttpServletRequest request = new MockHttpServletRequest(); + MockHttpServletResponse response = new MockHttpServletResponse(); + X509ProcessingFilterEntryPoint entryPoint = new X509ProcessingFilterEntryPoint(); + + entryPoint.commence(request, response, new BadCredentialsException("As thrown by security enforcement filter")); + assertEquals(HttpServletResponse.SC_FORBIDDEN, response.getStatus()); + + } +}