Package com.suarte.webapp.action

Source Code of com.suarte.webapp.action.PasswordHintTest

package com.suarte.webapp.action;

import org.subethamail.wiser.Wiser;
import org.appfuse.service.UserManager;
import org.appfuse.service.RoleManager;
import org.appfuse.service.MailEngine;
import org.springframework.mail.SimpleMailMessage;

public class PasswordHintTest extends BasePageTestCase {
    private PasswordHint bean;

    @Override
    public void onSetUp() throws Exception {
        super.onSetUp();
        bean = new PasswordHint();
        bean.setUserManager((UserManager) applicationContext.getBean("userManager"));
        bean.setMessage((SimpleMailMessage) applicationContext.getBean("mailMessage"));
        bean.setMailEngine((MailEngine) applicationContext.getBean("mailEngine"));
        bean.setTemplateName("accountCreated.vm");
    }

    public void testExecute() throws Exception {
        // start SMTP Server
        Wiser wiser = new Wiser();
        wiser.setPort(getSmtpPort());
        wiser.start();

        bean.setUsername("user");
        assertEquals("success", bean.execute());
        assertFalse(bean.hasErrors());

        // verify an account information e-mail was sent
        wiser.stop();
        assertTrue(wiser.getMessages().size() == 1);

        // verify that success messages are in the request
        assertNotNull(bean.getSession().getAttribute("messages"));
    }
}
TOP

Related Classes of com.suarte.webapp.action.PasswordHintTest

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.