acc.setUserName("rob");
Role r = new Role();
r.setRole(UserRole.MEMBER.toString());
acc.addRole(r);
Person p = new Person();
p.setRole(UserRole.MEMBER);
p.setLinkedAccount(acc);
acc.setUserProfile(p);
// mock out calls to other service classes
when(accountService.loadAccountByUserName("rob")).thenReturn(acc);
when(contactService.loadPerson(1l)).thenReturn(p);
try {
emailService.sendEmail("rob", "test Email body..", "1");
} catch (ButterflyException e) {
fail("Unexpected Exception");
}
assertEquals(1, p.getReceivedMessages().size());
assertEquals("test Email body..", p.getReceivedMessages().get(0).getDetails());
}