?? 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 + -