@Test
public void testUpdateBatchRequest() throws Exception {

  Clusters clustersMock = createMock(Clusters.class);
  Cluster clusterMock = createMock(Cluster.class);
  RequestExecution requestExecutionMock = createMock(RequestExecution.class);
  Configuration configurationMock = createNiceMock(Configuration.class);
  ExecutionScheduler executionSchedulerMock = createMock(ExecutionScheduler.class);
  InternalTokenStorage tokenStorageMock = createMock(InternalTokenStorage.class);
  ActionDBAccessor actionDBAccessorMock = createMock(ActionDBAccessor.class);
  Gson gson = new Gson();
  BatchRequest batchRequestMock = createMock(BatchRequest.class);
  long executionId = 11L;
  long batchId = 1L;
  long requestId = 5L;
  String clusterName = "mycluster";
  Map<Long, RequestExecution> executionMap = new HashMap<Long, RequestExecution>();
  executionMap.put(executionId, requestExecutionMock);
  BatchRequestResponse batchRequestResponse = new BatchRequestResponse();
  batchRequestResponse.setStatus(HostRoleStatus.IN_PROGRESS.toString());
  batchRequestResponse.setRequestId(requestId);
  batchRequestResponse.setReturnCode(202);
  EasyMock.expect(configurationMock.getApiSSLAuthentication()).andReturn(Boolean.FALSE);
  EasyMock.replay(configurationMock);
  ExecutionScheduleManager scheduleManager = createMockBuilder(ExecutionScheduleManager.class).
      withConstructor(configurationMock, executionSchedulerMock, tokenStorageMock, clustersMock,
          actionDBAccessorMock, gson).
      addMockedMethods("performApiRequest").createNiceMock();
  expect(clustersMock.getCluster(clusterName)).andReturn(clusterMock).anyTimes();
  expect(clusterMock.getAllRequestExecutions()).andReturn(executionMap).anyTimes();
  requestExecutionMock.updateBatchRequest(eq(batchId), eq(batchRequestResponse), eq(true));
  expectLastCall().once();
  replay(clusterMock, clustersMock, requestExecutionMock, executionSchedulerMock,
      tokenStorageMock, batchRequestMock, scheduleManager);
  scheduleManager.updateBatchRequest(executionId, batchId, clusterName, batchRequestResponse, true);
  verify(clusterMock, clustersMock, configurationMock, requestExecutionMock, executionSchedulerMock,
      tokenStorageMock, batchRequestMock, scheduleManager);
}