KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > common > ResourceReaderTest


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * ResourceReaderTest.java
20  *
21  * JUnit based test
22  */

23
24 package com.rift.coad.lib.common;
25
26 import com.rift.coad.lib.common.*;
27 import junit.framework.*;
28 import java.lang.ClassLoader JavaDoc;
29 import java.io.*;
30 import java.net.URL JavaDoc;
31
32 /**
33  *
34  * @author mincemeat
35  */

36 public class ResourceReaderTest extends TestCase {
37     
38     public ResourceReaderTest(String JavaDoc testName) {
39         super(testName);
40     }
41
42     protected void setUp() throws Exception JavaDoc {
43     }
44
45     protected void tearDown() throws Exception JavaDoc {
46     }
47
48     public static Test suite() {
49         TestSuite suite = new TestSuite(ResourceReaderTest.class);
50         
51         return suite;
52     }
53
54     /**
55      * Test of getPath method, of class com.rift.coad.lib.common.ResourceReader.
56      */

57     public void testGetPath() throws Exception JavaDoc {
58         System.out.println("getPath");
59         
60         ResourceReader instance = new ResourceReader(
61                 "com/rift/coad/lib/common/coadunation-test.xml");
62         
63         String JavaDoc expResult = "com/rift/coad/lib/common/coadunation-test.xml";
64         String JavaDoc result = instance.getPath();
65         assertEquals(expResult, result);
66         
67         
68     }
69     
70     
71     /**
72      * Test of getPath method, of class com.rift.coad.lib.common.ResourceReader.
73      */

74     public void testReader() throws Exception JavaDoc {
75         System.out.println("testReader");
76         
77         ResourceReader instance = new ResourceReader(
78                 "com/rift/coad/lib/common/coadunation-test.xml");
79         
80         String JavaDoc result = instance.getDocument();
81         if (!result.contains("\n")) {
82             fail("No ending lines were found");
83         }
84     }
85 }
86
Popular Tags