### Question:
MapBasedSearchResponseContextHandlerLookup implements SearchResponseContextHandlerLookup { @Override public SearchResponseContextHandler getHandler(Class responseClassToHandle) { SearchResponseContextHandler handler = mappings.get(responseClassToHandle); return handler == null ? defaultMapping : handler; } MapBasedSearchResponseContextHandlerLookup(final Configuration config);  MapBasedSearchResponseContextHandlerLookup(SearchResponseContextHandler defaultMapping,
                                                      Map<Class,SearchResponseContextHandler> mappings); static Map<Class, SearchResponseContextHandler> createDefaultHandlerMap(SearchResponseContextHandler defaultHandler,
                                                                                    Configuration config); @Override SearchResponseContextHandler getHandler(Class responseClassToHandle);  }### Answer:
@Test public void testGetHandlerReturnsDefaultMapping() throws Exception { SearchResponseContextHandler h = defaultLookup.getHandler(Long.class); assertSame(DebugSearchResponseContextHandler.INSTANCE,h); }
@Test public void testDefaultHandlerReturnedForCustomLookup() { assertSame(mockHandler1, customMappingsLookup.getHandler(Long.class)); assertSame(mockHandler2,customMappingsLookup.getHandler(String.class)); assertSame(DebugSearchResponseContextHandler.INSTANCE,customMappingsLookup.getHandler(AsyncContext.class)); }
@Test public void testDefaultMappings() { assertTrue(defaultLookup.getHandler(AsyncContext.class) instanceof SearchResponseContextHandler); assertSame(DebugSearchResponseContextHandler.INSTANCE,defaultLookup.getHandler(LogDebuggingSearchResponseContext.class)); }