### Question:
ReportExecutionRestApi { @NotNull public ReportExecutionDescriptor runReportExecution(@NotNull ReportExecutionRequestOptions executionOptions) throws IOException, HttpException { Utils.checkNotNull(executionOptions, "Execution options should not be null"); HttpUrl url = mNetworkClient.getBaseUrl().resolve("rest_v2/reportExecutions"); RequestBody jsonRequestBody = mNetworkClient.createJsonRequestBody(executionOptions); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .post(jsonRequestBody) .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ReportExecutionDescriptor.class); } ReportExecutionRestApi(NetworkClient networkClient); @NotNull ReportExecutionDescriptor runReportExecution(@NotNull ReportExecutionRequestOptions executionOptions); @NotNull ReportExecutionDescriptor requestReportExecutionDetails(@NotNull String executionId); @NotNull ExecutionStatus requestReportExecutionStatus(@NotNull String executionId); boolean cancelReportExecution(@NotNull String executionId); boolean updateReportExecution(@NotNull String executionId,
                                         @NotNull List<ReportParameter> params);  }### Answer:
@Test public void shouldThroughRestErrorOnSearchRequestIfHttpError() throws Exception { mExpectedException.expect(HttpException.class); mWebMockRule.enqueue(MockResponseFactory.create500()); restApiUnderTest.runReportExecution(ReportExecutionRequestOptions.newRequest("/any/uri")); }
@Test public void bodyParameterShouldNotBeNullForRunReportExecution() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Execution options should not be null"); restApiUnderTest.runReportExecution(null); }
@Test public void shouldStartReportExecution() throws Exception { MockResponse response = MockResponseFactory.create200().setBody(reportExecutionResponse.asString()); mWebMockRule.enqueue(response); ReportExecutionRequestOptions options = ReportExecutionRequestOptions.newRequest("/my/uri"); restApiUnderTest.runReportExecution(options); RecordedRequest request = mWebMockRule.get().takeRequest(); assertThat(request, containsHeader("Accept", "application/json; charset=UTF-8")); assertThat(request, hasPath("/rest_v2/reportExecutions")); assertThat(request, wasMethod("POST")); assertThat(request, hasBody("{\"reportUnitUri\":\"/my/uri\"}")); }