?? chattest.java
字號(hào):
package org.ellab.elchat;
import junit.framework.TestCase;
/**
* Test case for <code>Chat</code>.
*/
public class ChatTest extends TestCase {
protected void setUp() throws Exception {
ChatConfig.init("webapp/WEB-INF/elchat.properties");
Chat.init(null);
}
private void doTestUrl(String url) {
assertEquals("<a href='" + url + "' target='_blank'>" + url + "</a>", new Chat().createMessage("", "", url,
false, false, false).getText());
}
private void doTestProtocol(String urlSuffix) {
doTestUrl("http://" + urlSuffix);
doTestUrl("https://" + urlSuffix);
}
private void doTestDomain(String domain) {
doTestProtocol(domain);
doTestProtocol(domain + "elchat");
doTestProtocol(domain + "elchat/");
doTestProtocol(domain + "elchat/elchat.gif");
}
public void testUrl() {
doTestDomain("www.ellab.org/");
doTestDomain("www.ellab-test.org/");
doTestDomain("www.ellab-test.org:8080/");
doTestDomain("a/");
doTestProtocol("a");
}
private void doTestImg(String url) {
String result = new Chat().createMessage("", "", url, false, true, false).getText();
assertEquals("<img src='" + url + "' border='0'/>", result);
}
public void testImg() {
doTestImg("http://www.ellab.org:8080/chat.gif");
doTestImg("http://www.ellab.org:8080/ch!@#$%^*at-_.gif");
}
/*
public void testMultiLineImg() {
assertEquals("<img src='http://a.com/a.gif' border='0'/>" + "<br/>"
+ "<img src='http://b.com/b.png' border='0'/>", new Chat().createMessage("", "",
"http://a.com/a.gif\r\nhttp://b.com/b.png", false, true, false).getText());
}
*/
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -