### Question:
GenericListJsonResourceProvider extends ResourceProvider { @Override public Resource getResource(ResolveContext rc, String path, ResourceContext resourcecontext, Resource parent) { ResourceResolver resourceResolver = rc.getResourceResolver(); if (path == null) { return null; } else if (path.equals(ROOT)) { return null; } else { String listPath; if (path.endsWith(EXTENSION)) { listPath = path.substring(ROOT.length(), path.length() - EXTENSION_LENGTH); } else { listPath = path.substring(ROOT.length()); } String fullListPath = listRoot + listPath; Page listPage = resourceResolver.adaptTo(PageManager.class).getPage(fullListPath); if (listPage == null) { return null; } else { GenericList list = listPage.adaptTo(GenericList.class); if (list == null) { return null; } else { ResourceMetadata rm = new ResourceMetadata(); rm.setResolutionPath(path); return new JsonResource(list, resourceResolver, rm); } } } }  @Override Resource getResource(ResolveContext rc, String path, ResourceContext resourcecontext, Resource parent); @Override Iterator<Resource> listChildren(ResolveContext rc, Resource parent);  }### Answer:
@Test public void testRootResource() { assertNull(provider.getResource(resolveContext, GenericListJsonResourceProvider.ROOT, null, null)); }
@Test public void testPageWhichDoesntExist() { assertNull(provider.getResource(resolveContext, nonExisting, null, null)); }
@Test public void testPageWhichDoesntAdapt() { assertNull(provider.getResource(resolveContext, badMntPath, null, null)); }
@Test public void testPageWhichDoesAdapt() { Resource r = provider.getResource(resolveContext, goodMntPath, null, null); assertNotNull(r); }
@Test public void testPageWhichDoesAdaptWithExtension() { Resource r = provider.getResource(resolveContext, goodMntPath + ".json", null, null); assertNotNull(r); }