@Test public void shouldThroughRestErrorOnSearchRequestIfHttpError() throws Exception { mExpectedException.expect(HttpException.class); mWebMockRule.enqueue(MockResponseFactory.create500()); restApiUnderTest.runReportExecution(ReportExecutionRequestOptions.newRequest("/any/uri")); }
@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 { @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 { @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); }
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); }
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);  }