@Test
  public void testomponentVersionMismatch() throws Exception {
    // reset expectation so that it returns a wrong version
    ServiceComponentHost sch = m_hostComponentMap.get(HOSTNAME_1).get(0);
    EasyMock.reset(sch);
    expect(sch.getServiceName()).andReturn("FOO").atLeastOnce();
    expect(sch.getServiceComponentName()).andReturn("FOO_COMPONENT").atLeastOnce();
    expect(sch.getVersion()).andReturn(WRONG_VERSION).atLeastOnce();

    replayAll();

    m_metaInfo.init();

    // precondition that no events were fired
    assertEquals(0, m_listener.getAlertEventReceivedCount(AlertReceivedEvent.class));

    // instantiate and inject mocks
    ComponentVersionAlertRunnable runnable = new ComponentVersionAlertRunnable(
        m_definition.getDefinitionName());

    m_injector.injectMembers(runnable);

    // run the alert
    runnable.run();

    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.WARNING, alert.getState());
    assertEquals(DEFINITION_NAME, alert.getName());

    verifyAll();
  }
Tests that the alert which fires when there is a mismatch is a WARNING.
ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java