1
2
3
4
5
6
7
8 package gov.noaa.eds.xapi.generic.handlers;
9
10 import junit.framework.*;
11 import java.net.URL;
12
13 /***
14 *
15 * @author tns
16 */
17 public class ResourceHandlerTest extends TestCase {
18
19 ResourceHandler handler = null;
20
21 public ResourceHandlerTest(String testName) {
22 super(testName);
23 }
24
25 protected void setUp() throws java.lang.Exception {
26 handler = new ResourceHandler();
27 }
28
29 protected void tearDown() throws java.lang.Exception {
30 }
31
32 public static junit.framework.Test suite() {
33 junit.framework.TestSuite suite = new junit.framework.TestSuite(ResourceHandlerTest.class);
34
35 return suite;
36 }
37
38 /***
39 * Test of getResource method, of class gov.noaa.eds.xapi.generic.handlers.ResourceHandler.
40 */
41 public void testGetResource() {
42 System.out.println("testGetResource");
43
44
45 handler.setResource("testXmlResource.xml");
46 String res = handler.getResource();
47 assertNotNull("resource should not return null",res);
48 assertEquals("unexpected resource","testXmlResource.xml",res);
49 }
50
51 public void testUrlConvertsProperty(){
52 handler.setResource("testXmlResource.xml");
53 URL url = this.getClass().getClassLoader().getResource("testXmlResource.xml");
54 URL convertUrl = handler.getUrl();
55 assertNotNull("url string should have a value",convertUrl);
56 assertEquals("url did not get converted property",url,convertUrl);
57 }
58
59 /***
60 * Test of setResource method, of class gov.noaa.eds.xapi.generic.handlers.ResourceHandler.
61 */
62 public void testSetResource() {
63 System.out.println("testSetResource");
64
65
66 handler.setResource("testXmlResource.xml");
67 }
68
69
70
71
72 }