@@ -54,9 +54,6 @@ public class HTMLValidationRule extends StringValidationRule {
5454 private static final Logger LOGGER = ESAPI .getLogger ( "HTMLValidationRule" );
5555 private static final String ANTISAMYPOLICY_FILENAME = "antisamy-esapi.xml" ;
5656
57- //TESTING -- Mock Classloaders, verify that the classloader is called as desired with the searchpath and filename concat
58- // Verify that when no match is found, null is returned
59- // Verify that when match is found, remaining classloaders are not invoked and expected InputStream is returned.
6057 /*package */ static InputStream getResourceStreamFromClassLoader (String contextDescription , ClassLoader classLoader , String fileName , List <String > searchPaths ) {
6158 InputStream result = null ;
6259
@@ -73,9 +70,6 @@ public class HTMLValidationRule extends StringValidationRule {
7370 return result ;
7471 }
7572
76- //TESTING
77- // Harder to test... Use Junit to place files in each of the DefaultSearchPathLocations and verify that the file can be found.
78- // Not sure how to test that the classpaths are iterated.
7973 /*package */ static InputStream getResourceStreamFromClasspath (String fileName ) {
8074 LOGGER .info (Logger .EVENT_FAILURE , "Loading " + fileName + " from classpaths" );
8175
@@ -97,12 +91,6 @@ public class HTMLValidationRule extends StringValidationRule {
9791 return resourceStream ;
9892 }
9993
100- //TESTING
101- // Mock SecurityConfiguration - Return file check (true) - return resourceStream - expect Policy object
102- // Mock SecurityConfiguration - Return file check (false) - use junit to place file in any of the DefaultSearchPathLocations - verify Policy Object
103- // Mock SecurityConfiguration - return file check (true) - throw IOException on resource stream - Verify IOException
104- // Mock SecurityConfiguration - return file Check (true) - use Junit to place a BAD FILE - verify PolicyException
105- // HOW TO TEST NULL RETURN.....
10694 /*package */ static Policy loadAntisamyPolicy (String antisamyPolicyFilename ) throws IOException , PolicyException {
10795 InputStream resourceStream = null ;
10896 SecurityConfiguration secCfg = ESAPI .securityConfiguration ();
@@ -115,9 +103,6 @@ public class HTMLValidationRule extends StringValidationRule {
115103 return resourceStream == null ? null : Policy .getInstance (resourceStream );
116104 }
117105
118- //TESTING
119- // Mock SecurityConfiguration - return a valid string on property request - verify String is returned from call
120- // Mock SecurityConfiguration -- throw ConfigurationException on property request -- Verify Default Filename is returned from call
121106 /*package */ static String resolveAntisamyFilename () {
122107 String antisamyPolicyFilename = ANTISAMYPOLICY_FILENAME ;
123108 try {
@@ -133,10 +118,6 @@ public class HTMLValidationRule extends StringValidationRule {
133118 return antisamyPolicyFilename ;
134119 }
135120
136- //TESTING
137- // Mock SecurityConfiguration - return file check (true) - throw IOException on resource stream - Verify ConfigurationException from IOException
138- // Mock SecurityConfiguration - return file Check (true) - use Junit to place a BAD FILE - verify ConfigurationException from PolicyException
139- // Force NULL return from loadAntisamyPolicy call -- Verify ConfigurationException from null value
140121 /*package */ static void configureInstance () {
141122 String antisamyPolicyFilename = resolveAntisamyFilename ();
142123
@@ -156,8 +137,6 @@ public class HTMLValidationRule extends StringValidationRule {
156137
157138 }
158139
159- //TESTING
160- // None.
161140 static {
162141 configureInstance ();
163142 }
0 commit comments