HTTP { public static Optional<String> getContentTypeFromExtension(String filename) { String ext = filename.substring(filename.lastIndexOf('.') + 1); return Optional.fromNullable(mimeTypes.getProperty(ext)); }  static Optional<String> getContentTypeFromExtension(String filename); static boolean isTextContentType(String contentType); static Optional<String> charsetFromContentType(String s); static String headerTokenCompatible(String s, String specialCharsReplacement);  }
@Test public void should_find_mime_type() throws Exception { assertThat(HTTP.getContentTypeFromExtension("test.js")).isEqualTo(Optional.of("application/x-javascript")); assertThat(HTTP.getContentTypeFromExtension("html")).isEqualTo(Optional.of("text/html")); assertThat(HTTP.getContentTypeFromExtension("css")).isEqualTo(Optional.of("text/css")); }