@Test
public void testSave() throws Exception {
doc = tester.renderPage("admin/UserList");
Element addLink = doc.getElementById("add");
doc = tester.clickLink(addLink);
Element form = doc.getElementById("form");
assertNotNull(form);
fieldValues.put("username", "tapestry");
fieldValues.put("password", "isfun");
fieldValues.put("confirmPassword", "isfun");
fieldValues.put("passwordHint", "funstuff");
fieldValues.put("firstName", "Tapestry");
fieldValues.put("lastName", "5");
fieldValues.put("email", "tapestry@appfuse.org");
fieldValues.put("website", "http://tapestry.apache.org");
fieldValues.put("city", "Portland");
fieldValues.put("state", "OR");
fieldValues.put("postalCode", "97303");
fieldValues.put("country", "US");
// start SMTP Server
Wiser wiser = new Wiser();
wiser.setPort(getSmtpPort());
wiser.start();
doc = tester.submitForm(form, fieldValues);
Element errors = doc.getElementById("errorMessages");
if (errors != null) {
log.error(errors);
}
assertNull(doc.getElementById("errorMessages"));
// verify an account information e-mail was sent
assertEquals(1, wiser.getMessages().size());
wiser.stop();
//Element successMessages = doc.getElementById("successMessages");
//assertNotNull(successMessages);
//assertTrue(successMessages.toString().contains("added successfully"));
assertTrue(doc.toString().contains("added successfully"));
Element table = doc.getElementById("userList");
assertTrue(table.toString().contains("tapestry"));
}