### Question:
ReportExecutionRestApi { public boolean updateReportExecution(@NotNull String executionId, @NotNull List<ReportParameter> params) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(params, "Execution params should not be null"); Utils.checkArgument(params.isEmpty(), "Execution params should not be empty"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("parameters") .build(); RequestBody jsonRequestBody = mNetworkClient.createJsonRequestBody(params); 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); int status = response.code(); return status == 204; } 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 bodyParameterShouldNotBeNullForExecutionUpdate() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Execution params should not be null"); restApiUnderTest.updateReportExecution("any_id", null); }
@Test public void bodyParameterShouldNotBeEmptyForExecutionUpdate() throws Exception { mExpectedException.expect(IllegalArgumentException.class); mExpectedException.expectMessage("Execution params should not be empty"); restApiUnderTest.updateReportExecution("any_id", Collections.<ReportParameter>emptyList()); }
@Test public void shouldUpdateReportExecution() throws Exception { MockResponse response = MockResponseFactory.create204(); mWebMockRule.enqueue(response); restApiUnderTest.updateReportExecution(EXEC_ID, PARAMS); RecordedRequest request = mWebMockRule.get().takeRequest(); assertThat(request, containsHeader("Accept", "application/json; charset=UTF-8")); assertThat(request, hasPath("/rest_v2/reportExecutions/f3a9805a-4089-4b53-b9e9-b54752f91586/parameters")); assertThat(request, hasBody("[{\"name\":\"key\",\"value\":[\"value\"]}]")); assertThat(request, wasMethod("POST")); }
@Test public void executionUpdateRequestShouldBeSuccessIfResponseIs204() throws Exception { mWebMockRule.enqueue(MockResponseFactory.create204()); boolean response = restApiUnderTest.updateReportExecution("any_id", PARAMS); assertThat(response, is(true)); }