KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > examples > rss > TestRSS


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17
18 package org.apache.commons.betwixt.examples.rss;
19
20 import java.io.File JavaDoc;
21
22 import org.apache.commons.betwixt.AbstractTestCase;
23
24 /**
25  * <p>Test case for example.</p>
26  *
27  * @author Robert Burrell Donkin
28  * @version $Revision: 1.5 $ $Date: 2004/06/13 21:32:47 $
29  */

30
31 public class TestRSS extends AbstractTestCase {
32
33     public TestRSS(String JavaDoc testName) {
34         super(testName);
35     }
36
37     public void testPrintTextSummary() throws Exception JavaDoc {
38         RSSApplication rssApplication = new RSSApplication();
39         File JavaDoc file = new File JavaDoc(
40             getTestFile("src/test/org/apache/commons/betwixt/examples/rss/rss-example.xml"));
41         String JavaDoc output = rssApplication.plainTextSummary(file);
42         String JavaDoc expected = "channel: MozillaZine\n" +
43                             "url: http://www.mozillazine.org\n" +
44                             "copyright: Public Domain\n\n" +
45                             "title: Java2 in Navigator 5?\n" +
46                             "link: http://www.mozillazine.org/talkback.html?article=607\n" +
47                             "description: Will Java2 be an integrated part of Navigator 5? " +
48                             "Read more about it in this discussion...\n\n" +
49                             "title: Communicator 4.61 Out\n" +
50                             "link: http://www.mozillazine.org/talkback.html?article=606\n" +
51                             "description: The latest version of Communicator is now " +
52                             "available. It includes security enhancements " +
53                             "and various bug fixes.\n\n" +
54                             "title: Mozilla Dispenses with Old, Proprietary DOM\n" +
55                             "link: http://www.mozillazine.org/talkback.html?article=604\n" +
56                             "description: \n\n" +
57                             "title: The Animation Contest is Now Closed\n" +
58                             "link: http://www.mozillazine.org/talkback.html?article=603\n" +
59                             "description: \n";
60         assertEquals(output, expected);
61     }
62 }
63
Popular Tags