@Test
  public void testSignupUser() throws Exception {
    MockHttpServletRequest request = newPost("/signup.html");

    Address address = new Address();
    address.setCity("Denver");
    address.setProvince("Colorado");
    address.setCountry("USA");
    address.setPostalCode("80210");

    User user = new User();
    user.setAddress(address);

    user.setUsername("self-registered");
    user.setPassword("Password1");
    user.setConfirmPassword("Password1");
    user.setFirstName("First");
    user.setLastName("Last");
    user.setEmail("*****@*****.**");
    user.setWebsite("http://raibledesigns.com");
    user.setPasswordHint("Password is one with you.");

    HttpServletResponse response = new MockHttpServletResponse();

    // start SMTP Server
    Wiser wiser = new Wiser();
    wiser.setPort(getSmtpPort());
    wiser.start();

    BindingResult errors = new DataBinder(user).getBindingResult();
    c.onSubmit(user, errors, request, response);
    assertFalse("errors returned in model", errors.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(request.getSession().getAttribute("successMessages"));
    assertNotNull(request.getSession().getAttribute(Constants.REGISTERED));

    SecurityContextHolder.getContext().setAuthentication(null);
  }
  public void testSignupUser() throws Exception {
    MockHttpServletRequest request = newPost("/signup.html");
    request.addParameter("username", "self-registered");
    request.addParameter("password", "Password1");
    request.addParameter("confirmPassword", "Password1");
    request.addParameter("firstName", "First");
    request.addParameter("lastName", "Last");
    request.addParameter("address.city", "Denver");
    request.addParameter("address.province", "Colorado");
    request.addParameter("address.country", "USA");
    request.addParameter("address.postalCode", "80210");
    request.addParameter("email", "*****@*****.**");
    request.addParameter("website", "http://raibledesigns.com");
    request.addParameter("passwordHint", "Password is one with you.");

    HttpServletResponse response = new MockHttpServletResponse();

    // start SMTP Server
    Wiser wiser = new Wiser();
    wiser.setPort(2525);
    wiser.start();

    ModelAndView mv = c.handleRequest(request, response);
    Errors errors = (Errors) mv.getModel().get(BindException.MODEL_KEY_PREFIX + "user");
    assertTrue("no errors returned in model", errors == null);

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

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

    SecurityContextHolder.getContext().setAuthentication(null);
  }
 public void testDisplayForm() throws Exception {
   MockHttpServletRequest request = newGet("/signup.html");
   HttpServletResponse response = new MockHttpServletResponse();
   ModelAndView mv = c.handleRequest(request, response);
   assertTrue("returned correct view name", mv.getViewName().equals("signup"));
 }
 @Test
 public void testDisplayForm() throws Exception {
   User user = c.showForm();
   assertNotNull(user);
 }