1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2008, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
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  }