private void checkSingleEventToState(AlertState alertState) {
    assertEquals(1,
        m_listener.getAlertEventReceivedCount(AlertReceivedEvent.class));

    List<AlertEvent> events = m_listener.getAlertEventInstances(AlertReceivedEvent.class);
    assertEquals(1, events.size());

    AlertReceivedEvent event = (AlertReceivedEvent) events.get(0);
    Alert alert = event.getAlert();
    assertEquals("AMBARI", alert.getService());
    assertEquals("AMBARI_SERVER", alert.getComponent());
    assertEquals(alertState, alert.getState());
    assertEquals(DEFINITION_NAME, alert.getName());
  }
Tests that a stale alert in maintenance mode doesn't trigger the event.
ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java