### Question:
ReportOptionRestApi { @NotNull public ReportOptionEntity createReportOption( @NotNull String reportUnitUri, @NotNull String optionLabel, @NotNull List<ReportParameter> parameters, boolean overwrite) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); Utils.checkNotNull(optionLabel, "Option label should not be null"); Utils.checkNotNull(parameters, "Parameters values should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()) .newBuilder() .addQueryParameter("label", optionLabel) .addQueryParameter("overwrite", String.valueOf(overwrite)) .build(); Map<String, Set<String>> controlsValues = ReportParamsMapper.INSTANCE.toMap(parameters); RequestBody requestBody = mNetworkClient.createJsonRequestBody(controlsValues); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .post(requestBody) .url(url) .build(); Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ReportOptionEntity.class); } ReportOptionRestApi(NetworkClient networkClient); @NotNull Set<ReportOptionEntity> requestReportOptionsList(
            @NotNull String reportUnitUri); @NotNull ReportOptionEntity createReportOption(
            @NotNull String reportUnitUri,
            @NotNull String optionLabel,
            @NotNull List<ReportParameter> parameters,
            boolean overwrite); void updateReportOption(
            @NotNull String reportUnitUri,
            @NotNull String optionId,
            @NotNull List<ReportParameter> parameters); void deleteReportOption(
            @Nullable String reportUnitUri,
            @Nullable String optionId);  }### Answer:
@Test public void createReportOptionShouldNotAllowNullReportUri() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Report uri should not be null"); restApiUnderTest.createReportOption(null, "label", REPORT_PARAMS, false); }
@Test public void createReportOptionShouldNotAllowNullOptionLabel() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Option label should not be null"); restApiUnderTest.createReportOption("any_id", null, REPORT_PARAMS, false); }
@Test public void createReportOptionShouldNotAllowNullControlsValues() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Parameters values should not be null"); restApiUnderTest.createReportOption("any_id", "label", null, false); }
@Test public void apiShouldCreateReportOption() throws Exception { MockResponse mockResponse = MockResponseFactory.create200().setBody(reportOption.asString()); mWebMockRule.enqueue(mockResponse); ReportOptionEntity reportOption = restApiUnderTest.createReportOption("/any/uri", "my label", REPORT_PARAMS, true); assertThat(reportOption.getId(), is("my_label")); assertThat(reportOption.getLabel(), is("my label")); assertThat(reportOption.getUri(), is("/public/Samples/Reports/my_label")); RecordedRequest request = mWebMockRule.get().takeRequest(); assertThat(request.getPath(), is("/rest_v2/reports/any/uri/options?label=my%20label&overwrite=true")); assertThat(request.getBody().readUtf8(), is("{\"sales_fact_ALL__store_sales_2013_1\":[\"19\"]}")); }