### Question:
OverridePathSlingRequestWrapper extends SlingHttpServletRequestWrapper { @Override public Resource getResource() { return this.resource; } OverridePathSlingRequestWrapper(final SlingHttpServletRequest request, final String path);  OverridePathSlingRequestWrapper(final SlingHttpServletRequest request, final String path, BindingsValuesProvidersByContext bindingsValuesProvidersByContext); @Override Object getAttribute(final String name); @Override Resource getResource(); @Override AdapterType adaptTo(Class<AdapterType> type);  }### Answer:
@Test public void testResource() { this.context.currentResource(RESOURCE_PATH); OverridePathSlingRequestWrapper pageResourceWrapper = new OverridePathSlingRequestWrapper(this.context.request(), PAGE_CHILD_RESOURCE_PATH, bindingsValuesProvidersByContext); assertEquals(PAGE_CHILD_RESOURCE_PATH, pageResourceWrapper.getResource().getPath()); OverridePathSlingRequestWrapper resourceWrapper = new OverridePathSlingRequestWrapper(this.context.request(), RESOURCE_PATH, bindingsValuesProvidersByContext); assertEquals(RESOURCE_PATH, resourceWrapper.getResource().getPath()); }
@Test public void testSupportForNonExistingResource() { this.context.currentResource(new NonExistingResource(this.context.resourceResolver(), "/content/bogus1")); OverridePathSlingRequestWrapper bogusResourceWrapper = new OverridePathSlingRequestWrapper(this.context.request(), "/content/bogus2", bindingsValuesProvidersByContext); assertEquals("/content/bogus2", bogusResourceWrapper.getResource().getPath()); assertEquals(Resource.RESOURCE_TYPE_NON_EXISTING, bogusResourceWrapper.getResource().getResourceType()); }