コード例 #1
0
  @Test
  public void onProcessMessageIsSentAsEmail() throws Exception {
    Email email = new Email();
    when(contactMessageToEmail.apply(message)).thenReturn(email);

    contactService.process(message);

    verify(emailService).send(email);
  }
コード例 #2
0
  @Test
  public void onProcessMessageIsSaved() throws Exception {
    contactService.process(message);

    verify(messageRepository).save(message);
  }