01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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;
29: import java.io.*;
30: import java.net.URL;
31:
32: /**
33: *
34: * @author mincemeat
35: */
36: public class ResourceReaderTest extends TestCase {
37:
38: public ResourceReaderTest(String testName) {
39: super (testName);
40: }
41:
42: protected void setUp() throws Exception {
43: }
44:
45: protected void tearDown() throws Exception {
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 {
58: System.out.println("getPath");
59:
60: ResourceReader instance = new ResourceReader(
61: "com/rift/coad/lib/common/coadunation-test.xml");
62:
63: String expResult = "com/rift/coad/lib/common/coadunation-test.xml";
64: String result = instance.getPath();
65: assertEquals(expResult, result);
66:
67: }
68:
69: /**
70: * Test of getPath method, of class com.rift.coad.lib.common.ResourceReader.
71: */
72: public void testReader() throws Exception {
73: System.out.println("testReader");
74:
75: ResourceReader instance = new ResourceReader(
76: "com/rift/coad/lib/common/coadunation-test.xml");
77:
78: String result = instance.getDocument();
79: if (!result.contains("\n")) {
80: fail("No ending lines were found");
81: }
82: }
83: }
|