Ejemplo n.º 1
0
 @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"));
 }
Ejemplo n.º 2
0
 @Test
 public void should_extract_charset() throws Exception {
   assertThat(HTTP.charsetFromContentType("text/html; charset=UTF-8"))
       .isEqualTo(Optional.of("UTF-8"));
   assertThat(HTTP.charsetFromContentType("application/json; charset=ISO-8859-1"))
       .isEqualTo(Optional.of("ISO-8859-1"));
   assertThat(HTTP.charsetFromContentType("application/json"))
       .isEqualTo(Optional.<String>absent());
 }