StaticResourceServlet extends HttpServlet { static String getContentType(final String fileName) { return contentTypes.get(StringUtils.lowerCase(StringUtils .substringAfterLast(fileName, "."))); }    }
@Test public void getContentType() { Assert.assertEquals("text/plain", StaticResourceServlet.getContentType("foo.txt")); Assert.assertEquals("text/html", StaticResourceServlet.getContentType("index.html")); Assert.assertEquals("text/plain", StaticResourceServlet.getContentType("README.TXT")); }