// Path: src/main/java/com/raibledesigns/Constants.java
// public final class Constants {
// 
//     private Constants() {
//         // hide me
//     }
//     //~ Static fields/initializers =============================================
// 
//     /**
//      * Assets Version constant
//      */
//     public static final String ASSETS_VERSION = "assetsVersion";
//     /**
//      * The name of the ResourceBundle used in this application
//      */
//     public static final String BUNDLE_KEY = "ApplicationResources";
// 
//     /**
//      * File separator from System properties
//      */
//     public static final String FILE_SEP = System.getProperty("file.separator");
// 
//     /**
//      * User home from System properties
//      */
//     public static final String USER_HOME = System.getProperty("user.home") + FILE_SEP;
// 
//     /**
//      * The name of the configuration hashmap stored in application scope.
//      */
//     public static final String CONFIG = "appConfig";
// 
//     /**
//      * Session scope attribute that holds the locale set by the user. By setting this key
//      * to the same one that Struts uses, we get synchronization in Struts w/o having
//      * to do extra work or have two session-level variables.
//      */
//     public static final String PREFERRED_LOCALE_KEY = "org.apache.struts2.action.LOCALE";
// 
//     /**
//      * The request scope attribute under which an editable user form is stored
//      */
//     public static final String USER_KEY = "userForm";
// 
//     /**
//      * The request scope attribute that holds the user list
//      */
//     public static final String USER_LIST = "userList";
// 
//     /**
//      * The request scope attribute for indicating a newly-registered user
//      */
//     public static final String REGISTERED = "registered";
// 
//     /**
//      * The name of the Administrator role, as specified in web.xml
//      */
//     public static final String ADMIN_ROLE = "ROLE_ADMIN";
// 
//     /**
//      * The name of the User role, as specified in web.xml
//      */
//     public static final String USER_ROLE = "ROLE_USER";
// 
//     /**
//      * The name of the user's role list, a request-scoped attribute
//      * when adding/editing a user.
//      */
//     public static final String USER_ROLES = "userRoles";
// 
//     /**
//      * The name of the available roles list, a request-scoped attribute
//      * when adding/editing a user.
//      */
//     public static final String AVAILABLE_ROLES = "availableRoles";
// 
//     /**
//      * The name of the CSS Theme setting.
//      * @deprecated No longer used to set themes.
//      */
//     public static final String CSS_THEME = "csstheme";
// }


import com.raibledesigns.Constants;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.subethamail.wiser.Wiser;
import javax.transaction.Transactional;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
    public void testSignupUser() throws Exception {
        // start SMTP Server
        Wiser wiser = startWiser(getSmtpPort());

        ResultActions signup = mockMvc.perform(post("/signup.html")
                .param("address.city", "Denver")
                .param("address.province", "Colorado")
                .param("address.country", "USA")
                .param("address.postalCode", "80210")
                .param("username", "self-registered")
                .param("password", "Password1")
                .param("confirmPassword", "Password1")
                .param("firstName", "First")
                .param("lastName", "Last")
                .param("email", "self-registered@raibledesigns.com")
                .param("website", "http://raibledesigns.com")
                .param("passwordHint", "Password is one with you.")
        )
            .andExpect(status().is3xxRedirection())
            .andExpect(model().hasNoErrors());

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

        MvcResult result = signup.andReturn();
        MockHttpSession session = (MockHttpSession) result.getRequest().getSession();

        // verify that success messages are in the session
        assertNotNull(session.getAttribute("successMessages"));
// Path: src/main/java/com/raibledesigns/Constants.java
// public final class Constants {
// 
//     private Constants() {
//         // hide me
//     }
//     //~ Static fields/initializers =============================================
// 
//     /**
//      * Assets Version constant
//      */
//     public static final String ASSETS_VERSION = "assetsVersion";
//     /**
//      * The name of the ResourceBundle used in this application
//      */
//     public static final String BUNDLE_KEY = "ApplicationResources";
// 
//     /**
//      * File separator from System properties
//      */
//     public static final String FILE_SEP = System.getProperty("file.separator");
// 
//     /**
//      * User home from System properties
//      */
//     public static final String USER_HOME = System.getProperty("user.home") + FILE_SEP;
// 
//     /**
//      * The name of the configuration hashmap stored in application scope.
//      */
//     public static final String CONFIG = "appConfig";
// 
//     /**
//      * Session scope attribute that holds the locale set by the user. By setting this key
//      * to the same one that Struts uses, we get synchronization in Struts w/o having
//      * to do extra work or have two session-level variables.
//      */
//     public static final String PREFERRED_LOCALE_KEY = "org.apache.struts2.action.LOCALE";
// 
//     /**
//      * The request scope attribute under which an editable user form is stored
//      */
//     public static final String USER_KEY = "userForm";
// 
//     /**
//      * The request scope attribute that holds the user list
//      */
//     public static final String USER_LIST = "userList";
// 
//     /**
//      * The request scope attribute for indicating a newly-registered user
//      */
//     public static final String REGISTERED = "registered";
// 
//     /**
//      * The name of the Administrator role, as specified in web.xml
//      */
//     public static final String ADMIN_ROLE = "ROLE_ADMIN";
// 
//     /**
//      * The name of the User role, as specified in web.xml
//      */
//     public static final String USER_ROLE = "ROLE_USER";
// 
//     /**
//      * The name of the user's role list, a request-scoped attribute
//      * when adding/editing a user.
//      */
//     public static final String USER_ROLES = "userRoles";
// 
//     /**
//      * The name of the available roles list, a request-scoped attribute
//      * when adding/editing a user.
//      */
//     public static final String AVAILABLE_ROLES = "availableRoles";
// 
//     /**
//      * The name of the CSS Theme setting.
//      * @deprecated No longer used to set themes.
//      */
//     public static final String CSS_THEME = "csstheme";
// }


// Path: src/test/java/com/raibledesigns/webapp/controller/SignupControllerTest.java
import com.raibledesigns.Constants;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.subethamail.wiser.Wiser;
import javax.transaction.Transactional;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

    public void testSignupUser() throws Exception {
        // start SMTP Server
        Wiser wiser = startWiser(getSmtpPort());

        ResultActions signup = mockMvc.perform(post("/signup.html")
                .param("address.city", "Denver")
                .param("address.province", "Colorado")
                .param("address.country", "USA")
                .param("address.postalCode", "80210")
                .param("username", "self-registered")
                .param("password", "Password1")
                .param("confirmPassword", "Password1")
                .param("firstName", "First")
                .param("lastName", "Last")
                .param("email", "self-registered@raibledesigns.com")
                .param("website", "http://raibledesigns.com")
                .param("passwordHint", "Password is one with you.")
        )
            .andExpect(status().is3xxRedirection())
            .andExpect(model().hasNoErrors());

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

        MvcResult result = signup.andReturn();
        MockHttpSession session = (MockHttpSession) result.getRequest().getSession();

        // verify that success messages are in the session
        assertNotNull(session.getAttribute("successMessages"));
        assertNotNull(session.getAttribute(Constants.REGISTERED));