ResourceCacheControl implements Filter { String addPath(String path) { if (!path.startsWith("/")) { path = "/" + path; } if (!path.endsWith("/")) { path = path + "/"; } resourcePrefixes.add(path); return path; } ResourceCacheControl(); static synchronized void install(); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void destroy();  }
@Test public void test_addPath() { ResourceCacheControl resourceCacheControl = new ResourceCacheControl(); Assert.assertEquals("/a/b/", resourceCacheControl.addPath("a/b")); Assert.assertEquals("/a/b/", resourceCacheControl.addPath("/a/b")); Assert.assertEquals("/a/b/", resourceCacheControl.addPath("a/b/")); Assert.assertEquals("/a/b/", resourceCacheControl.addPath("/a/b/")); }