Package org.appfuse.webapp.controller

Source Code of org.appfuse.webapp.controller.PasswordHintControllerTest

package org.appfuse.webapp.controller;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpServletRequest;
import org.subethamail.wiser.Wiser;

import static org.junit.Assert.*;

public class PasswordHintControllerTest extends BaseControllerTestCase {
    @Autowired
    private PasswordHintController c = null;

    @Test
    public void testExecute() throws Exception {
        MockHttpServletRequest request = newGet("/passwordHint.html");
        request.addParameter("username", "user");

       // start SMTP Server
        Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();
       
        c.handleRequest(request);
       
        // verify an account information e-mail was sent
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);
       
        // verify that success messages are in the session
        assertNotNull(request.getSession().getAttribute(BaseFormController.MESSAGES_KEY));
    }
}
TOP

Related Classes of org.appfuse.webapp.controller.PasswordHintControllerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.