@Test
 public void test_metadata() throws Exception {
   NotificationDispatcherMetadata metadata = DoNotFixNotificationDispatcher.newMetadata();
   assertThat(metadata.getDispatcherKey()).isEqualTo(underTest.getKey());
   assertThat(metadata.getProperty(NotificationDispatcherMetadata.GLOBAL_NOTIFICATION))
       .isEqualTo("true");
   assertThat(metadata.getProperty(NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION))
       .isEqualTo("true");
 }
  @Test
  public void should_not_dispatch_if_other_notification_type() {
    Notification notification = new Notification("other");
    underTest.performDispatch(notification, context);

    verify(context, never()).addUser(any(String.class), any(NotificationChannel.class));
  }
  /** Only false positive and won't fix resolutions */
  @Test
  public void ignore_other_resolutions() {
    Multimap<String, NotificationChannel> recipients = HashMultimap.create();
    recipients.put("simon", emailChannel);
    recipients.put("freddy", twitterChannel);
    when(notifications.findNotificationSubscribers(underTest, "struts")).thenReturn(recipients);

    Notification fixedNotif =
        new IssueChangeNotification()
            .setFieldValue("projectKey", "struts")
            .setFieldValue("changeAuthor", "godin")
            .setFieldValue("new.resolution", Issue.RESOLUTION_FIXED)
            .setFieldValue("assignee", "freddy");
    underTest.performDispatch(fixedNotif, context);

    verifyZeroInteractions(context);
  }
  @Test
  public void should_dispatch_to_subscribers() {
    Multimap<String, NotificationChannel> recipients = HashMultimap.create();
    recipients.put("simon", emailChannel);
    recipients.put("freddy", twitterChannel);
    recipients.put("godin", twitterChannel);
    when(notifications.findNotificationSubscribers(underTest, "struts")).thenReturn(recipients);

    Notification fpNotif =
        new IssueChangeNotification()
            .setFieldValue("projectKey", "struts")
            .setFieldValue("changeAuthor", "godin")
            .setFieldValue("new.resolution", Issue.RESOLUTION_FALSE_POSITIVE)
            .setFieldValue("assignee", "freddy");
    underTest.performDispatch(fpNotif, context);

    verify(context).addUser("simon", emailChannel);
    verify(context).addUser("freddy", twitterChannel);
    // do not notify the person who flagged the issue as false-positive
    verify(context, never()).addUser("godin", twitterChannel);
    verifyNoMoreInteractions(context);
  }