1 20 21 package org.apache.cactus.integration.maven.test; 22 23 import org.apache.cactus.ServletTestCase; 24 import java.io.InputStream ; 25 26 34 public class TestResources extends ServletTestCase 35 { 36 private void includesTest( String resource ) 37 { 38 Thread currentThread = Thread.currentThread(); 39 ClassLoader classLoader = currentThread.getContextClassLoader(); 40 InputStream input = classLoader.getResourceAsStream(resource); 41 assertNotNull("could not open resource " + resource, input); 42 } 43 44 private void excludesTest( String resource ) 45 { 46 Thread currentThread = Thread.currentThread(); 47 ClassLoader classLoader = currentThread.getContextClassLoader(); 48 InputStream input = classLoader.getResourceAsStream(resource); 49 assertNull("should not have opened resource " + resource, input); 50 } 51 52 public void testConfigProperties() 53 { 54 includesTest( "test.properties" ); 55 } 56 57 public void testConfigXml() 58 { 59 includesTest( "test.xml" ); 60 } 61 62 public void testIncludes() 63 { 64 includesTest( "testKO.properties" ); 65 } 66 67 public void testExcludes() 68 { 69 excludesTest( "testbad.properties" ); 70 } 71 72 public void testRecursive() 73 { 74 includesTest( "recursiveResources/test-recursive.properties" ); 75 } 76 77 public void testRecursiveDefault() 78 { 79 includesTest( "recursiveResources/test-recursive-default.xml"); 80 } 81 } 82 | Popular Tags |