1 package org.appfuse.webapp.action; 2 3 import org.springframework.mock.web.MockHttpServletRequest; 4 import org.springframework.mock.web.MockHttpServletResponse; 5 6 import com.dumbster.smtp.SimpleSmtpServer; 7 8 9 public class PasswordHintControllerTest extends BaseControllerTestCase { 10 private PasswordHintController c; 11 12 protected void setUp() throws Exception { 13 super.setUp(); c = (PasswordHintController) ctx.getBean("passwordHintController"); 15 } 16 17 protected void tearDown() throws Exception { 18 super.tearDown(); 19 c = null; 20 } 21 22 public void testExecute() throws Exception { 23 MockHttpServletRequest request = newGet("/passwordHint.html"); 24 request.addParameter("username", "tomcat"); 25 26 SimpleSmtpServer server = SimpleSmtpServer.start(2525); 27 28 c.handleRequest(request, new MockHttpServletResponse()); 29 30 server.stop(); 32 assertTrue(server.getReceivedEmailSize() == 1); 33 34 assertNotNull(request.getSession().getAttribute("messages")); 36 } 37 } 38 | Popular Tags |