@Test
  public void testInvalidAlertDefinition() throws AmbariException {
    String componentName = "DATANODE";

    Alert alert = new Alert("missing_alert_definition_name", null, "HDFS",
        componentName, HOST1, AlertState.OK);

    alert.setLabel(ALERT_LABEL);
    alert.setText("HDFS " + componentName + " is OK");
    alert.setTimestamp(1L);

    // bad alert definition name means no current alerts
    AlertReceivedListener listener = m_injector.getInstance(AlertReceivedListener.class);
    AlertReceivedEvent event1 = new AlertReceivedEvent(
        m_cluster.getClusterId(), alert);
    listener.onAlertEvent(event1);

    List<AlertCurrentEntity> allCurrent = m_dao.findCurrent();
    assertEquals(0, allCurrent.size());
  }
Tests that a disabled definition doesn't record alert events.
ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java