You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/06/29 18:32:55 UTC

[2/3] struts git commit: Cleans up test

Cleans up test


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/ab6acd23
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/ab6acd23
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/ab6acd23

Branch: refs/heads/support-2-3
Commit: ab6acd23820ab90f870c2d6dcf16ffc8cacf4d09
Parents: bf0a01d
Author: Lukasz Lenart <lu...@apache.org>
Authored: Sun Jun 26 22:04:23 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Sun Jun 26 22:04:23 2016 +0200

----------------------------------------------------------------------
 .../xwork2/ognl/SecurityMemberAccessTest.java   | 32 +++-----------------
 1 file changed, 4 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/ab6acd23/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java
----------------------------------------------------------------------
diff --git a/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java b/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java
index b719432..8f98c25 100644
--- a/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java
+++ b/xwork-core/src/test/java/com/opensymphony/xwork2/ognl/SecurityMemberAccessTest.java
@@ -119,24 +119,6 @@ public class SecurityMemberAccessTest extends TestCase {
         assertTrue("fooLogic() from FooInterface isn't accessible!!!", accessible);
     }
 
-    public void testMiddleOfInheritanceExclusion2() throws Exception {
-        // given
-        SecurityMemberAccess sma = new SecurityMemberAccess(false);
-
-        String propertyName = "barLogic";
-        Member member = BarInterface.class.getMethod(propertyName);
-
-        Set<Class<?>> excluded = new HashSet<Class<?>>();
-        excluded.add(BarInterface.class);
-        sma.setExcludedClasses(excluded);
-
-        // when
-        boolean accessible = sma.isAccessible(context, target, member, propertyName);
-
-        // then
-        assertFalse("barLogic() from BarInterface is accessible!!!", accessible);
-    }
-
     public void testMiddleOfInheritanceExclusion3() throws Exception {
         // given
         SecurityMemberAccess sma = new SecurityMemberAccess(false);
@@ -144,12 +126,6 @@ public class SecurityMemberAccessTest extends TestCase {
         String propertyName = "barLogic";
         Member member = BarInterface.class.getMethod(propertyName);
 
-/*
-        Set<Class<?>> excluded = new HashSet<Class<?>>();
-        excluded.add(BarInterface.class);
-        sma.setExcludedClasses(excluded);
-*/
-
         // when
         boolean accessible = sma.isAccessible(context, target, member, propertyName);
 
@@ -256,7 +232,7 @@ public class SecurityMemberAccessTest extends TestCase {
     public void testAccessStatic() throws Exception {
         // given
         SecurityMemberAccess sma = new SecurityMemberAccess(true);
-        sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
+        sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
 
         // when
         Member method = StaticTester.class.getMethod("sayHello");
@@ -269,7 +245,7 @@ public class SecurityMemberAccessTest extends TestCase {
     public void testBlockStaticAccess() throws Exception {
         // given
         SecurityMemberAccess sma = new SecurityMemberAccess(false);
-        sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
+        sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
 
         // when
         Member method = StaticTester.class.getMethod("sayHello");
@@ -282,7 +258,7 @@ public class SecurityMemberAccessTest extends TestCase {
     public void testBlockStaticAccessIfClassIsExcluded() throws Exception {
         // given
         SecurityMemberAccess sma = new SecurityMemberAccess(false);
-        sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(Class.class)));
+        sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(Class.class)));
 
         // when
         Member method = Class.class.getMethod("getClassLoader");
@@ -295,7 +271,7 @@ public class SecurityMemberAccessTest extends TestCase {
     public void testAllowStaticAccessIfClassIsNotExcluded() throws Exception {
         // given
         SecurityMemberAccess sma = new SecurityMemberAccess(true);
-        sma.setExcludedClasses(new HashSet<Class<?>>(Arrays.<Class<?>>asList(ClassLoader.class)));
+        sma.setExcludedClasses(new HashSet<Class<?>>(Collections.singletonList(ClassLoader.class)));
 
         // when
         Member method = Class.class.getMethod("getClassLoader");