@Test public void requestReportOptionsListShouldNotAllowNullReportUnitUri() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Report uri should not be null"); restApiUnderTest.requestReportOptionsList(null); }
@NotNull public Set<ReportOptionEntity> requestReportOptionsList( @NotNull String reportUnitUri) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); Response response = mNetworkClient.makeCall(request); try { ReportOptionSet reportOptionSet = mNetworkClient.deserializeJson(response, ReportOptionSet.class); return Collections.unmodifiableSet(reportOptionSet.get()); } catch (JsonSyntaxException ex) { return Collections.emptySet(); } }
ReportOptionRestApi { @NotNull public Set<ReportOptionEntity> requestReportOptionsList( @NotNull String reportUnitUri) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); Response response = mNetworkClient.makeCall(request); try { ReportOptionSet reportOptionSet = mNetworkClient.deserializeJson(response, ReportOptionSet.class); return Collections.unmodifiableSet(reportOptionSet.get()); } catch (JsonSyntaxException ex) { return Collections.emptySet(); } } }
ReportOptionRestApi { @NotNull public Set<ReportOptionEntity> requestReportOptionsList( @NotNull String reportUnitUri) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); Response response = mNetworkClient.makeCall(request); try { ReportOptionSet reportOptionSet = mNetworkClient.deserializeJson(response, ReportOptionSet.class); return Collections.unmodifiableSet(reportOptionSet.get()); } catch (JsonSyntaxException ex) { return Collections.emptySet(); } } ReportOptionRestApi(NetworkClient networkClient); }
ReportOptionRestApi { @NotNull public Set<ReportOptionEntity> requestReportOptionsList( @NotNull String reportUnitUri) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); Response response = mNetworkClient.makeCall(request); try { ReportOptionSet reportOptionSet = mNetworkClient.deserializeJson(response, ReportOptionSet.class); return Collections.unmodifiableSet(reportOptionSet.get()); } catch (JsonSyntaxException ex) { return Collections.emptySet(); } } 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); }
ReportOptionRestApi { @NotNull public Set<ReportOptionEntity> requestReportOptionsList( @NotNull String reportUnitUri) throws IOException, HttpException { Utils.checkNotNull(reportUnitUri, "Report uri should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reports") .addPaths(reportUnitUri) .addPath("options") .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); Response response = mNetworkClient.makeCall(request); try { ReportOptionSet reportOptionSet = mNetworkClient.deserializeJson(response, ReportOptionSet.class); return Collections.unmodifiableSet(reportOptionSet.get()); } catch (JsonSyntaxException ex) { return Collections.emptySet(); } } 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);  }