MimeTypes { static ContentType get(String fileName) { int index = fileName.lastIndexOf('.'); if (index > 0 && index + 1 < fileName.length()) { String extension = fileName.substring(index + 1); return MIME_TYPES.get(ASCII.toLowerCase(extension)); } return null; }    }
@Test void get() { assertThat(MimeTypes.get("file")).isNull(); ContentType contentType = MimeTypes.get("favicon.ico"); assertThat(contentType).isNotNull(); assertThat(contentType.mediaType).isEqualTo("image/x-icon"); }