@Test public void onProcessMessageIsSentAsEmail() throws Exception { Email email = new Email(); when(contactMessageToEmail.apply(message)).thenReturn(email); contactService.process(message); verify(emailService).send(email); }
@Test public void onProcessMessageIsSaved() throws Exception { contactService.process(message); verify(messageRepository).save(message); }