?? testgmsendmailbody.java
字號:
package siuying.gm.test;
import siuying.gm.*;
import java.util.*;
import siuying.gm.structure.*;
import java.io.*;
import java.util.logging.*;
import junit.framework.*;
/**
* Class to test GMSendMailBody
* Only test the addCC/Bcc/To and getCc/Bcc/To methods, others are obviously
* cannot be wrong!
*/
public class TestGMSendMailBody extends TestCase{
private Logger logger = Logger.getLogger(TestXMLStorage.class.getName());
private GMSendMailBody body;
protected void setUp() {
body = new GMSendMailBody();
}
public void testCc(){
body.addCc("hellocc@hello.com");
body.addCc("hellocc2@namo.com");
String[] stdList = {"hellocc@hello.com", "hellocc2@namo.com"};
String[] list = body.getCc();
assertEquals(stdList.length, list.length);
assertEquals(stdList[0], list[0]);
assertEquals(stdList[1], list[1]);
assertEquals("hellocc@hello.com;hellocc2@namo.com", body.getCcAsString());
}
public void testBcc(){
body.addBcc("hellobc@hello.com");
body.addBcc("hellobc2@namo.com");
body.addBcc("hellobc3@namo.com");
String[] stdList = {"hellobc@hello.com", "hellobc2@namo.com", "hellobc3@namo.com"};
String[] list = body.getBcc();
assertEquals(stdList.length, list.length);
assertEquals(stdList[0], list[0]);
assertEquals(stdList[1], list[1]);
assertEquals("hellobc@hello.com;hellobc2@namo.com;hellobc3@namo.com", body.getBccAsString());
}
public void testTo(){
body.addTo("helloto@hello.com");
body.addTo("hello2to@namo.com");
String[] stdList = {"helloto@hello.com", "hello2to@namo.com"};
String[] list = body.getTo();
assertEquals(stdList.length, list.length);
assertEquals(stdList[0], list[0]);
assertEquals(stdList[1], list[1]);
assertEquals("helloto@hello.com;hello2to@namo.com", body.getToAsString());
}
public void testEquals(){
GMSendMailBody testbody1 = new GMSendMailBody();
GMSendMailBody testbody2 = new GMSendMailBody();
String sendto = "hello2@namo.com";
testbody1.addTo(sendto);
testbody2.addTo(sendto);
String hello = "Hello, World!";
testbody1.setSubject(hello);
testbody2.setSubject(hello);
String content = "This is test msg body";
testbody1.setMsgbody(content);
testbody2.setMsgbody(content);
testbody1.setDraft("0");
testbody2.setDraft("0");
assertTrue(testbody1.equals(testbody2));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -