### Question:
RewriteModule extends AbstractModule { protected Provider<List<ResponseRewriter>> getResponseRewriters(String container, RewriteFlow flow) { return binder().getProvider(getKey(container, flow)); }  @Provides @Singleton @RewriterRegistry(rewriteFlow = RewriteFlow.DEFAULT) ResponseRewriterRegistry provideDefaultList(GadgetHtmlParser parser,
      Provider<Map<RewritePath, Provider<List<ResponseRewriter>>>> rewritePathToRewriterList); @Provides @Singleton @RewriterRegistry(rewriteFlow = RewriteFlow.REQUEST_PIPELINE) ResponseRewriterRegistry provideRequestPipelineList(GadgetHtmlParser parser,
      Provider<Map<RewritePath, Provider<List<ResponseRewriter>>>> rewritePathToRewriterList); @Provides @Singleton @RewriterRegistry(rewriteFlow = RewriteFlow.ACCELERATE) ResponseRewriterRegistry provideAccelerateList(GadgetHtmlParser parser,
      Provider<Map<RewritePath, Provider<List<ResponseRewriter>>>> rewritePathToRewriterList); static final String ACCEL_CONTAINER; static final String DEFAULT_CONTAINER; }### Answer:
@Test public void testDefaultRewriters() throws Exception { ContextAwareRegistry defaultPipelineRegistry = (ContextAwareRegistry) injector.getInstance(TestClass.class).defaultPipelineRegistry; List<ResponseRewriter> list = defaultPipelineRegistry.getResponseRewriters( ContainerConfig.DEFAULT_CONTAINER); assertEquals(7, list.size()); assertTrue(list.get(0) instanceof AbsolutePathReferenceRewriter); assertTrue(list.get(1) instanceof StyleTagExtractorContentRewriter); assertTrue(list.get(2) instanceof StyleAdjacencyContentRewriter); assertTrue(list.get(3) instanceof ProxyingContentRewriter); assertTrue(list.get(4) instanceof CssResponseRewriter); assertTrue(list.get(5) instanceof SanitizingResponseRewriter); assertTrue(list.get(6) instanceof CajaResponseRewriter); list = defaultPipelineRegistry.getResponseRewriters(AccelUriManager.CONTAINER); assertEquals(3, list.size()); assertTrue(list.get(0) instanceof AbsolutePathReferenceRewriter); assertTrue(list.get(1) instanceof StyleTagProxyEmbeddedUrlsRewriter); assertTrue(list.get(2) instanceof ProxyingContentRewriter); }
@Test public void testRequestPipelineRewriters() throws Exception { ContextAwareRegistry requestPipelineRegistry = (ContextAwareRegistry) injector.getInstance(TestClass.class).requestPipelineRegistry; List<ResponseRewriter> list = requestPipelineRegistry.getResponseRewriters( ContainerConfig.DEFAULT_CONTAINER); assertEquals(1, list.size()); assertTrue(list.get(0) instanceof BasicImageRewriter); list = requestPipelineRegistry.getResponseRewriters(AccelUriManager.CONTAINER); assertEquals(1, list.size()); assertTrue(list.get(0) instanceof BasicImageRewriter); }
@Test public void testAccelRewriters() throws Exception { ContextAwareRegistry accelPipelineRegistry = (ContextAwareRegistry) injector.getInstance(TestClass.class).accelPipelineRegistry; List<ResponseRewriter> list = accelPipelineRegistry.getResponseRewriters( AccelUriManager.CONTAINER); assertEquals(3, list.size()); assertTrue(list.get(0) instanceof AbsolutePathReferenceRewriter); assertTrue(list.get(1) instanceof StyleTagProxyEmbeddedUrlsRewriter); assertTrue(list.get(2) instanceof ProxyingContentRewriter); list = accelPipelineRegistry.getResponseRewriters(ContainerConfig.DEFAULT_CONTAINER); assertEquals(0, list.size()); }