private void addExpectForInitialRequest(ServiceTestInvocation testMethod) {
    RequestBody rb = new RequestBody();
    rb.setBody(testMethod.getBody());
    expect(requestFactory.createRequest(EasyMock.eq(httpHeaders), EasyMock.anyObject(RequestBody.class), EasyMock.eq(uriInfo),
      EasyMock.eq(testMethod.getRequestType()), EasyMock.eq(resourceInstance))).andReturn(request);
  }
Base class for service unit tests.
ambari-server/src/test/java/org/apache/ambari/server/api/services/BaseServiceTest.java