passwordhintactiontest.java

来自「this is for appfuse1.8 source using stru」· Java 代码 · 共 38 行

JAVA
38
字号
package org.appfuse.webapp.action;import org.springframework.mock.web.MockHttpServletRequest;import com.dumbster.smtp.SimpleSmtpServer;import com.opensymphony.webwork.ServletActionContext;public class PasswordHintActionTest extends BaseActionTestCase {    private PasswordHintAction action;    protected void setUp() throws Exception {            super.setUp();        action = (PasswordHintAction) ctx.getBean("passwordHintAction");    }        protected void tearDown() throws Exception {        super.tearDown();        action = null;    }    public void testExecute() throws Exception {        action.setUsername("tomcat");                SimpleSmtpServer server = SimpleSmtpServer.start(2525);                assertEquals(action.execute(), "success");        assertFalse(action.hasActionErrors());        // verify an account information e-mail was sent        server.stop();        assertTrue(server.getReceivedEmailSize() == 1);                // verify that success messages are in the request        assertNotNull(action.getSession().getAttribute("messages"));    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?