### Question:
OverridePathSlingRequestWrapper extends SlingHttpServletRequestWrapper { @Override public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) { AdapterType result = null; synchronized(this) { result = (AdapterType) this.adaptersCache.get(type); if (result == null) { AdapterManager mgr = Activator.getAdapterManager(); if (mgr == null) { LOG.warn("Unable to adapt request for path {} to {} because AdapterManager is null", this.resource.getPath(), type); } else { result = mgr.getAdapter(this, type); } if (result != null) { this.adaptersCache.put(type, result); } } return result; } } 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 testAdaptTo() { this.context.currentResource(RESOURCE_PATH); OverridePathSlingRequestWrapper pageResourceWrapper = new OverridePathSlingRequestWrapper(this.context.request(), PAGE_CHILD_RESOURCE_PATH, bindingsValuesProvidersByContext); TestAdaptable adapted = pageResourceWrapper.adaptTo(TestAdaptable.class); assertNotNull(adapted); }
@Test public void testAdaptToWithNoBindings() { this.context.request().setAttribute(SlingBindings.class.getName(), null); this.context.currentResource(RESOURCE_PATH); OverridePathSlingRequestWrapper pageResourceWrapper = new OverridePathSlingRequestWrapper(this.context.request(), PAGE_CHILD_RESOURCE_PATH, bindingsValuesProvidersByContext); TestAdaptable adapted = pageResourceWrapper.adaptTo(TestAdaptable.class); assertNotNull(adapted); }