} finally {
mailServer.stop();
}
assertTrue(mailServer.getReceivedEmailSize() == 2);
Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
SmtpMessage email = (SmtpMessage) emailIter.next();
assertTrue(email.getHeaderValue("Subject").equals("Account Registration Pending"));
assertNotNull(email.getBody());
assertTrue(email.getBody().contains("NotifyEmail"));
assertTrue(email.getBody().contains("Username(johnp)"));
assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=johnp"));
email = (SmtpMessage) emailIter.next();
assertTrue(email.getHeaderValue("Subject").equals("Account Registration Approval"));
assertNotNull(email.getBody());
assertTrue(email.getBody().contains("ApprovalEmail"));
assertTrue(email.getBody().contains("CreatedOn: "));
assertTrue(email.getBody().contains("Email(johnp@example.com)"));
assertTrue(email.getBody().contains("Username(johnp)"));
assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=johnp"));
User user = userManager.getUser("johnp","poploop");
assertEquals(AccountStatus.INACTIVE,user.getAccountStatus().intValue());
}