### Question:
RepositoryRestApi { @NotNull public ResourceLookup requestResource(@NotNull String resourceUri, @NotNull String type) throws IOException, HttpException { Utils.checkNotNull(resourceUri, "Report uri should not be null"); Utils.checkNotNull(type, "Report type should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("resources") .addPaths(resourceUri) .build() .resolve(mNetworkClient.getBaseUrl()); Request request = new Request.Builder() .addHeader("Accept", String.format("application/repository.%s+json", type)) .get() .url(url) .build(); com.squareup.okhttp.Response rawResponse = mNetworkClient.makeCall(request); if ("file".equals(type)) { return mNetworkClient.deserializeJson(rawResponse, FileLookup.class); } if ("folder".equals(type)) { return mNetworkClient.deserializeJson(rawResponse, FolderLookup.class); } if ("reportUnit".equals(type)) { return mNetworkClient.deserializeJson(rawResponse, ReportLookup.class); } return mNetworkClient.deserializeJson(rawResponse, ResourceLookup.class); } RepositoryRestApi(NetworkClient networkClient); @NotNull ResourceSearchResult searchResources(@NotNull Map<String, Object> searchParams); @NotNull ResourceLookup requestResource(@NotNull String resourceUri, @NotNull String type); @NotNull DashboardComponentCollection requestDashboardComponents(@NotNull String dashboardUri); @NotNull OutputResource requestResourceOutput(@NotNull String resourceUri);  }### Answer:
@Test public void requestForResourceByTypeShouldNotAcceptNullType() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Report type should not be null"); restApiUnderTest.requestResource("/", null); }
@Test public void requestForResourceByTypeShouldNotAcceptNullUri() throws Exception { mExpectedException.expect(NullPointerException.class); mExpectedException.expectMessage("Report uri should not be null"); restApiUnderTest.requestResource(null, "file"); }
@Test @Parameters({ "reportUnit|com.jaspersoft.android.sdk.network.entity.resource.ReportLookup", "folder|com.jaspersoft.android.sdk.network.entity.resource.FolderLookup", "file|com.jaspersoft.android.sdk.network.entity.resource.FileLookup" }) public void shouldRequestReportResources(String type, String className) throws Exception { mWebMockRule.enqueue(MockResponseFactory.create200().setBody("{}")); ResourceLookup expected = restApiUnderTest.requestResource("/my/uri", type); assertThat(expected, instanceOf(Class.forName(className))); RecordedRequest request = mWebMockRule.get().takeRequest(); assertThat(request, containsHeader("Accept", String.format("application/repository.%s+json", type))); assertThat(request, hasPath("/rest_v2/resources/my/uri")); assertThat(request, wasMethod("GET")); }