1 20 package org.apache.maven.cactus.sample; 21 22 import org.apache.cactus.ServletTestCase; 23 import org.apache.cactus.WebRequest; 24 25 30 public class TestSampleServlet extends ServletTestCase 31 { 32 36 public void testIsAuthenticatedAuthenticated() 37 { 38 SampleServlet servlet = new SampleServlet(); 39 40 session.setAttribute("authenticated", "true"); 41 42 assertTrue(servlet.isAuthenticated(request)); 43 } 44 45 49 public void testIsAuthenticatedNotAuthenticated() 50 { 51 SampleServlet servlet = new SampleServlet(); 52 53 assertTrue(!servlet.isAuthenticated(request)); 54 } 55 56 62 public void beginIsAuthenticatedNoSession(WebRequest theRequest) 63 { 64 theRequest.setAutomaticSession(false); 65 } 66 67 71 public void testIsAuthenticatedNoSession() 72 { 73 SampleServlet servlet = new SampleServlet(); 74 75 assertTrue(!servlet.isAuthenticated(request)); 76 } 77 } 78 | Popular Tags |