use of com.google.common.net.MediaType in project guava by hceylan.
the class MediaTypeTest method testCreateVideoType.
public void testCreateVideoType() {
MediaType newType = MediaType.createVideoType("yams");
assertEquals("video", newType.type());
assertEquals("yams", newType.subtype());
}
use of com.google.common.net.MediaType in project guava by hceylan.
the class MediaTypeTest method testCreateAudioType.
public void testCreateAudioType() {
MediaType newType = MediaType.createAudioType("yams");
assertEquals("audio", newType.type());
assertEquals("yams", newType.subtype());
}
use of com.google.common.net.MediaType in project guava by hceylan.
the class MediaTypeTest method testWithParameters_invalidAttribute.
public void testWithParameters_invalidAttribute() {
MediaType mediaType = MediaType.parse("text/plain");
ImmutableListMultimap<String, String> parameters = ImmutableListMultimap.of("a", "1", "@", "2", "b", "3");
try {
mediaType.withParameters(parameters);
fail();
} catch (IllegalArgumentException expected) {
}
}
use of com.google.common.net.MediaType in project guava by hceylan.
the class MediaTypeTest method testWithParameter_invalidAttribute.
public void testWithParameter_invalidAttribute() {
MediaType mediaType = MediaType.parse("text/plain");
try {
mediaType.withParameter("@", "2");
fail();
} catch (IllegalArgumentException expected) {
}
}
use of com.google.common.net.MediaType in project guava by hceylan.
the class MediaTypeTest method testGetCharset_tooMany.
public void testGetCharset_tooMany() {
MediaType mediaType = MediaType.parse("text/plain; charset=utf-8; charset=utf-16");
try {
mediaType.charset();
fail();
} catch (IllegalStateException expected) {
}
}
Aggregations