ContentTypeUtil { public static String getContentTypeByPath(String ext) { ext = PathUtil.getExtention(ext); return getContentType(ext); } private  ContentTypeUtil(); static String getContentTypeByPath(String ext); static String getContentType(String ext);  }
@Test public void testContentTypeByPath() { assertEquals("text/plain", ContentTypeUtil.getContentTypeByPath("/a/bb.txt")); assertEquals("text/html", ContentTypeUtil.getContentTypeByPath("/a/bb.html")); assertNull(ContentTypeUtil.getContentTypeByPath("/a/bb.notexists")); assertNull(ContentTypeUtil.getContentTypeByPath("/a/bb")); }