@Test public void shouldNotNotifyIfNoNewViolations() throws Exception { Project project = new Project("key"); Measure m = new Measure(CoreMetrics.NEW_VIOLATIONS); when(context.getMeasure(CoreMetrics.NEW_VIOLATIONS)).thenReturn(m); // NULL is returned here decorator.notifyNewViolations(project, context); verify(notificationManager, never()).scheduleForSending(any(Notification.class)); // 0 will be returned now m.setVariation1(0.0); decorator.notifyNewViolations(project, context); verify(notificationManager, never()).scheduleForSending(any(Notification.class)); }
@Test public void shouldNotNotifyIfNoNotEnoughPastSnapshots() throws Exception { Project project = new Project("key"); // the #setUp method adds 2 snapshots: if last period analysis is 3, then it's not enough when(timeMachineConfiguration.getProjectPastSnapshots()) .thenReturn(new ArrayList<PastSnapshot>()); decorator.notifyNewViolations(project, context); verify(notificationManager, never()).scheduleForSending(any(Notification.class)); }