📄 mimedictionarytest.java
字号:
// $Id: MIMEDictionaryTest.java,v 1.3 2001/01/23 00:48:31 nconway Exp $
package tornado.test;
import tornado.*;
import java.io.File;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.framework.TestCase;
public class MIMEDictionaryTest extends TestCase {
File mappingFile = new File("data/mime.types");
MIMEDictionary mime;
public MIMEDictionaryTest(String name) {
super(name);
}
protected void setUp() {
mime = new MIMEDictionary(mappingFile);
}
protected void tearDown() {
mime = null;
}
public void testGetContentType() {
String type = mime.getContentType("zip");
assertEquals(type, "application/zip");
}
public void testGetMultiContentType() {
String type = mime.getContentType("mp2");
String type2 = mime.getContentType("mp3");
assertEquals(type, type2);
}
public void testGetUnknownContentType() {
String type = mime.getContentType("%%%");
assertEquals(type, "application/octet-stream");
}
public void testAddContentType() {
mime.addContentType("test", "application/test");
String type = mime.getContentType("test");
assertEquals(type, "application/test");
}
public void testComment() {
String type = mime.getContentType("comment");
assert(! type.equals("application/comment"));
}
public static Test suite() {
return new TestSuite(MIMEDictionaryTest.class);
}
public static void main(String[] args) {
String[] testCaseName = {MIMEDictionaryTest.class.getName()};
junit.textui.TestRunner.main(testCaseName);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -