@Test
  public void testNoDispatch() throws Exception {
    EasyMock.expect(m_dao.findPendingNotices()).andReturn(
      new ArrayList<>()).once();

    // m_dispatchFactory should not be called at all
    EasyMock.replay(m_dao, m_dispatchFactory);

    // "startup" the service so that its initialization is done
    AlertNoticeDispatchService service = m_injector.getInstance(AlertNoticeDispatchService.class);
    service.startUp();

    // service trigger
    service.runOneIteration();

    EasyMock.verify(m_dao, m_dispatchFactory);
  }
Tests that the dispatcher is not called when there are no notices.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java