/** * Given: Nobody wants to receive notifications. * * <p>When: Freddy adds comment to review created by Evgeny and assigned to Simon. * * <p>Then: No notifications. */ @Test public void scenario4() { Notification notification = mock(Notification.class); creator = USER_EVGENY; assignee = USER_SIMON; service.deliver(notification); verify(emailChannel, atLeast(1)).getKey(); verify(gtalkChannel, atLeast(1)).getKey(); verifyNoMoreInteractions(emailChannel); verifyNoMoreInteractions(gtalkChannel); }
/** * Given: Simon wants to receive notifications by email on comments for reviews assigned to him or * created by him. * * <p>When: Freddy adds comment to review created by Simon and assigned to Simon. * * <p>Then: Only one notification should be delivered to Simon by Email. */ @Test public void scenario1() { doReturn(true).when(manager).isEnabled(USER_SIMON, "email", "comment on review assigned to me"); doReturn(true).when(manager).isEnabled(USER_SIMON, "email", "comment on review created by me"); Notification notification = mock(Notification.class); creator = USER_SIMON; assignee = USER_SIMON; service.deliver(notification); verify(emailChannel, atLeast(1)).getKey(); verify(gtalkChannel, atLeast(1)).getKey(); verify(emailChannel).deliver(notification, USER_SIMON); verifyNoMoreInteractions(emailChannel); verifyNoMoreInteractions(gtalkChannel); }