@Test
  public void testSoftAlertDoesNotCreateNotifications() throws Exception {
    AlertDefinitionEntity definition = getMockAlertDefinition();

    AlertCurrentEntity current = getMockedAlertCurrentEntity();
    AlertHistoryEntity history = createNiceMock(AlertHistoryEntity.class);
    AlertStateChangeEvent event = createNiceMock(AlertStateChangeEvent.class);
    Alert alert = createNiceMock(Alert.class);

    // make the alert SOFT so that no notifications are sent
    EasyMock.expect(current.getAlertHistory()).andReturn(history).anyTimes();
    EasyMock.expect(current.getFirmness()).andReturn(AlertFirmness.SOFT).atLeastOnce();

    EasyMock.expect(history.getAlertDefinition()).andReturn(definition).atLeastOnce();
    EasyMock.expect(alert.getText()).andReturn("The HDFS Foo Alert Is Not Good").atLeastOnce();
    EasyMock.expect(alert.getState()).andReturn(AlertState.CRITICAL).atLeastOnce();
    EasyMock.expect(event.getCurrentAlert()).andReturn(current).atLeastOnce();
    EasyMock.expect(event.getNewHistoricalEntry()).andReturn(history).atLeastOnce();
    EasyMock.expect(event.getAlert()).andReturn(alert).atLeastOnce();

    replayAll();
    eventPublisher.publish(event);
    verifyAll();
  }
Tests that an alert with a firmness of {@link AlertFirmness#SOFT} does not
trigger any notifications.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java