PluginMediaServlet extends BaseUploadServlet { @Override public void init(final ServletConfig config) throws ServletException { final String pattern = config.getInitParameter("url-pattern"); if (pattern != null && !pattern.trim().isEmpty()) { if (pattern.endsWith("/")) { this.pattern = pattern; } else { this.pattern = pattern + "/"; } if (this.pattern.startsWith("/")) { mediaServletURI.setURI(this.pattern.substring(1)); } else { mediaServletURI.setURI(this.pattern); } } this.root = fileSystem.getRootDirectories().iterator().next(); }  @Override void init(final ServletConfig config); @Override void doGet(final HttpServletRequest req,
                      final HttpServletResponse resp);  }
@Test public void testInit() throws Exception { when(iterable.iterator()).thenReturn(iterator); when(fileSystem.getRootDirectories()).thenReturn(iterable); when(config.getInitParameter(anyString())).thenReturn("/fake"); when(ioService.newFileSystem(any(URI.class), anyMapOf(String.class, Class.class))).thenReturn(fileSystem); servlet.init(config); verify(mediaServletURI).setURI(eq("fake/")); }