01: package pygmy.nntp.test;
02:
03: import junit.framework.TestCase;
04: import junit.framework.Test;
05: import junit.framework.TestSuite;
06: import pygmy.nntp.Article;
07:
08: import java.io.File;
09: import java.io.IOException;
10:
11: public class ArticleTest extends TestCase {
12:
13: protected void setUp() throws Exception {
14: super .setUp();
15: }
16:
17: protected void tearDown() throws Exception {
18: super .tearDown();
19: }
20:
21: public void testArticle() throws IOException {
22: Article article = NntpTestUtil.createArticle("test.eml");
23:
24: assertEquals("1.0", article.getHeader().get("Mime-Version"));
25: assertEquals("<blkdu9$pd8$1@hood.uits.indiana.edu>", article
26: .getMessageId());
27: assertEquals("Re: Static inner classes", article.getSubject());
28: String[] newsgroups = { "comp.lang.java.programmer" };
29: for (int i = 0; i < newsgroups.length; i++) {
30: assertEquals(newsgroups[i], article.getNewsgroups()[i]);
31: }
32: }
33:
34: public static Test suite() {
35: return new TestSuite(ArticleTest.class);
36: }
37:
38: public static void main(String[] args) {
39: junit.textui.TestRunner.run(suite());
40: }
41: }
|