Merge pull request #4 from sullis/travis-openjdk11
add 'openjdk11' to Travis build matrix
diff --git a/pom.xml b/pom.xml
index 53c9d9c..46d5e4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -221,7 +221,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
+ <version>3.7.0</version>
<configuration>
<source>${maven.compile.source}</source>
<target>${maven.compile.target}</target>
@@ -251,7 +251,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.3.1</version>
+ <version>3.1.0</version>
<configuration>
<archive>
<compress>true</compress>
@@ -262,7 +262,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
- <version>2.4.1</version>
+ <version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
@@ -310,7 +310,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.13</version>
+ <version>2.21.0</version>
</plugin>
</plugins>
</pluginManagement>
diff --git a/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java b/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java
index 829ffb3..af7a77e 100644
--- a/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java
+++ b/src/test/java/org/apache/commons/ognl/internal/MethodPermCacheTest.java
@@ -34,21 +34,35 @@
* Date: 10/17/11
* Time: 12:13 AM
*/
-public class MethodPermCacheTest
-{
- private SecurityManager securityManager =new DummySecurityManager();
+public class MethodPermCacheTest {
+ private SecurityManager allowAllSecurityManager = new AllowAllSecurityManager();
+ private SecurityManager denyAllSecurityManager = new DenyAllSecurityManager();
- Cache<Method, Boolean> cache =
- new ConcurrentHashMapCache<Method, Boolean>( new MethodPermCacheEntryFactory( securityManager ) );
+ private Cache<Method, Boolean> createCache(SecurityManager securityManager) {
+ return new ConcurrentHashMapCache<Method, Boolean>(new MethodPermCacheEntryFactory(securityManager) );
+ }
+
@Test
- public void testGetPublicMethod( )
+ public void testGetPublicMethod_returnsTrue( )
throws CacheException, NoSuchMethodException
{
+ Cache<Method, Boolean> cache = createCache(allowAllSecurityManager);
+
Method method = Root.class.getMethod( "getArray");
Assert.assertTrue( cache.get( method ) );
}
- private class DummySecurityManager
+ @Test
+ public void testGetPublicMethod_returnsFalse( )
+ throws CacheException, NoSuchMethodException
+ {
+ Cache<Method, Boolean> cache = createCache(denyAllSecurityManager);
+ Method method = Root.class.getMethod( "getArray");
+
+ Assert.assertFalse( cache.get( method ) );
+ }
+
+ private class AllowAllSecurityManager
extends SecurityManager
{
@Override
@@ -56,4 +70,14 @@
{
}
}
+
+ private class DenyAllSecurityManager
+ extends SecurityManager
+ {
+ @Override
+ public void checkPermission( Permission perm )
+ {
+ throw new SecurityException("Denied.");
+ }
+ }
}