@Test
public void testExecuteScheduledAlerts_ForNoDataTrigger() {

    ServiceFactory sFactory = system.getServiceFactory();
    UserService userService = sFactory.getUserService();
    final AtomicInteger notificationCount = new AtomicInteger(0);
    final AtomicInteger clearCount = new AtomicInteger(0);
    Alert alert = new Alert(userService.findAdminUser(), userService.findAdminUser(), "testAlert", "-1h:scope:metric:avg", "* * * * *");
    _setAlertId(alert, "100001");
    Trigger trigger1 = new Trigger(alert, TriggerType.NO_DATA, "testTrigger1", 10, 1000*60);
    _setTriggerId(trigger1, "100002");
    Notification notification = new Notification("testNotification", alert, AuditNotifier.class.getName(), new ArrayList<String>(), 0);
    _setNotificationId(notification, "100004");
    alert.setTriggers(Arrays.asList(trigger1));
    alert.setNotifications(Arrays.asList(notification));
    notification.setTriggers(alert.getTriggers());
    alert.setEnabled(true);
    DefaultAlertService spyAlertService = _initializeSpyAlertServiceWithStubs(notificationCount, clearCount,
            Arrays.asList(), alert, notification, false);
    assertEquals(new Integer(1), spyAlertService.executeScheduledAlerts(1, 1000));
    assertEquals(1, notificationCount.get());
}