From 3e28c5fb7e618dc002cdbc6e4d0df9e2fd4bc155 Mon Sep 17 00:00:00 2001 From: Will Glass-Husain Date: Thu, 16 Jul 2020 22:24:06 -0700 Subject: tests for SecureIntrospection --- .../velocity/test/SecureIntrospectionTestCase.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'velocity-engine-core') diff --git a/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java b/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java index 9593433a..081e48b2 100644 --- a/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java +++ b/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java @@ -33,6 +33,9 @@ import org.apache.velocity.util.introspection.SecureUberspector; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; import java.util.Collection; import java.util.HashSet; @@ -172,6 +175,27 @@ public class SecureIntrospectionTestCase extends BaseTestCase return c; } + public ClassLoader getSampleClassLoader1() + { + return this.getClass().getClassLoader(); + } + + /** + * sample property which is a subclass of ClassLoader + * @return + */ + public ClassLoader getSampleClassLoader2() + { + try + { + return new URLClassLoader(new URL[]{new URL("file://.")}, this.getClass().getClassLoader()); + } + catch (MalformedURLException e) + { + throw new RuntimeException(e); + } + } + } -- cgit v1.2.3