@Test
  @SuppressWarnings("unchecked")
  public void testRunnableWithFailedCallEmptyResult() throws Exception {
    final String expectedHostName = "c6401.ambari.apache.org";
    final String expectedComponentName = "DATANODE";
    final String expectedClusterName = "clusterone";
    final String expectedComponentAndHostName = expectedComponentName + "+" + expectedHostName;
    final AtomicInteger testInteger = new AtomicInteger(0);

    final HostLogFilesResponse resp = new HostLogFilesResponse();
    resp.setHostLogFiles(new HashMap<>());
    EasyMockSupport mockSupport = new EasyMockSupport();

    LoggingRequestHelperFactory helperFactoryMock = mockSupport.createMock(LoggingRequestHelperFactory.class);
    AmbariManagementController controllerMock = mockSupport.createMock(AmbariManagementController.class);
    LoggingRequestHelper helperMock = mockSupport.createMock(LoggingRequestHelper.class);

    Cache<String, Set<String>> cacheMock = mockSupport.createMock(Cache.class);
    Set<String> currentRequestsMock = mockSupport.createMock(Set.class);
    Map<String, AtomicInteger> componentFailureCounts = mockSupport.createMock(Map.class);

    Capture<AtomicInteger> captureFailureCount = EasyMock.newCapture();

    expect(helperFactoryMock.getHelper(controllerMock, expectedClusterName)).andReturn(helperMock);
    // return null to simulate an error occurring during the LogSearch data request
    expect(helperMock.sendGetLogFileNamesRequest(expectedHostName)).andReturn(resp);
    // expect that the completed request is removed from the current request set,
    // even in the event of a failure to obtain the LogSearch data
    expect(currentRequestsMock.remove(expectedComponentAndHostName)).andReturn(true).once();
    // expect that the component failure map is initially empty
    expect(componentFailureCounts.containsKey(expectedComponentName)).andReturn(false);
    // expect that the component map is updated with a new count
    expect(componentFailureCounts.put(eq(expectedComponentName), capture(captureFailureCount))).andReturn(new AtomicInteger(0));
    // expect that the runnable will obtain an increment the failure count
    expect(componentFailureCounts.get(expectedComponentName)).andReturn(testInteger);

    mockSupport.replayAll();

    LogSearchDataRetrievalService.LogSearchFileNameRequestRunnable loggingRunnable =
      new LogSearchDataRetrievalService.LogSearchFileNameRequestRunnable(expectedHostName, expectedComponentName, expectedClusterName,
          cacheMock, currentRequestsMock, helperFactoryMock, componentFailureCounts, controllerMock);
    loggingRunnable.run();

    assertEquals("Initial count set by Runnable should be 0",
      0, captureFailureCount.getValue().get());
    assertEquals("Failure count should have been incremented",
      1, testInteger.get());

    mockSupport.verifyAll();
  }
This test verifies the basic behavior of the
  LogSearchDataRetrievalServiceTest, and should
  verify the interaction with its dependencies, as
  well as the interaction with the LogSearch
  server.
ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java