### Question:
PluggableDownloadStrategy implements DownloadStrategy { @PluginEventListener public void pluginModuleEnabled(final PluginModuleEnabledEvent event) { final ModuleDescriptor<?> module = event.getModule(); if (!(module instanceof DownloadStrategyModuleDescriptor)) { return; } register(module.getCompleteKey(), (DownloadStrategy) module.getModule()); } PluggableDownloadStrategy(final PluginEventManager pluginEventManager); boolean matches(final String urlPath); void serveFile(final HttpServletRequest request, final HttpServletResponse response); void register(final String key, final DownloadStrategy strategy); void unregister(final String key); @PluginEventListener void pluginModuleEnabled(final PluginModuleEnabledEvent event); @PluginEventListener void pluginModuleDisabled(final PluginModuleDisabledEvent event);  }### Answer:
@Test public void testPluginModuleEnabled() throws Exception { ModuleDescriptor module = new DownloadStrategyModuleDescriptor(getDefaultModuleClassFactory()) { public String getCompleteKey() { return "jungle.plugin:lion-strategy"; } public DownloadStrategy getModule() { return new StubDownloadStrategy("/lion", "ROAR!"); } }; strategy.pluginModuleEnabled(new PluginModuleEnabledEvent(module)); assertTrue(strategy.matches("/lion/something")); StringWriter result = new StringWriter(); Mock mockResponse = new Mock(HttpServletResponse.class); mockResponse.expectAndReturn("getWriter", new PrintWriter(result)); Mock mockRequest = new Mock(HttpServletRequest.class); mockRequest.expectAndReturn("getRequestURI", "/lion/something"); strategy.serveFile((HttpServletRequest) mockRequest.proxy(), (HttpServletResponse) mockResponse.proxy()); assertEquals("ROAR!" + IOUtils.LINE_SEPARATOR, result.toString()); }