1
2
3
4
5
6
7
8
9
10 package ch.qos.logback.core.util;
11
12 import static org.junit.Assert.*;
13
14 import org.junit.Test;
15
16
17 public class ContentTypeUtilTest {
18
19
20 @Test
21 public void smoke() {
22 String contextType = "text/html";
23 assertTrue(ContentTypeUtil.isTextual(contextType));
24 assertEquals("html", ContentTypeUtil.getSubType(contextType));
25 }
26
27 @Test
28 public void nullContext() {
29 String contextType = null;
30 assertFalse(ContentTypeUtil.isTextual(contextType));
31 assertNull(ContentTypeUtil.getSubType(contextType));
32 }
33
34 @Test
35 public void emptySubtype() {
36 String contextType = "text/";
37 assertTrue(ContentTypeUtil.isTextual(contextType));
38 assertNull(ContentTypeUtil.getSubType(contextType));
39 }
40 }