1 17 18 package javax.activation; 24 25 import java.util.Map; 26 27 import junit.framework.TestCase; 28 29 32 public class MimetypesFileTypeMapTest extends TestCase { 33 private MimetypesFileTypeMap typeMap; 34 35 public void testDefault() { 36 assertEquals("application/octet-stream", typeMap.getContentType("x.foo")); 38 assertEquals("text/html", typeMap.getContentType("x.html")); 40 } 41 42 public void testCommentRemoval() { 43 typeMap.addMimeTypes(" text/foo foo #txt"); 44 assertEquals("text/foo", typeMap.getContentType("x.foo")); 45 typeMap.addMimeTypes("#text/foo bar"); 46 assertEquals("text/foo", typeMap.getContentType("x.foo")); 47 typeMap.addMimeTypes("text/foo #bar"); 48 assertEquals("text/foo", typeMap.getContentType("x.foo")); 49 } 50 51 protected void setUp() throws Exception { 52 super.setUp(); 53 typeMap = new MimetypesFileTypeMap(); 54 } 55 } 56 | Popular Tags |