Adds additional use case to check access to values of int type

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

Branch: refs/heads/master
Commit: 4f0f7d13849d65445bb9f86c19b6eb217019123f
Parents: 54c6423
Author: Lukasz Lenart <lukaszlen...@apache.org>
Authored: Sat Mar 7 07:39:44 2015 +0100
Committer: Lukasz Lenart <lukaszlen...@apache.org>
Committed: Sat Mar 7 07:39:44 2015 +0100

----------------------------------------------------------------------
 .../xwork2/ognl/SecurityMemberAccessTest.java   | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4f0f7d13/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 53f4246..5db20fc 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
@@ -285,12 +285,28 @@ public class SecurityMemberAccessTest extends TestCase {
         assertTrue("Invalid test! Access to static method of excluded class is 
blocked!", actual);
     }
 
+    public void testAccessPrimitiveInt() throws Exception {
+        // given
+        SecurityMemberAccess sma = new SecurityMemberAccess(false);
+
+        String propertyName = "intField";
+        Member member = FooBar.class.getMethod("get" + 
propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1));
+
+        // when
+        boolean accessible = sma.isAccessible(context, target, member, 
propertyName);
+
+        // then
+        assertTrue(accessible);
+    }
+
 }
 
 class FooBar implements FooBarInterface {
 
     private String stringField;
 
+    private int intField;
+
     public String getStringField() {
         return stringField;
     }
@@ -312,6 +328,13 @@ class FooBar implements FooBarInterface {
         return 1;
     }
 
+    public int getIntField() {
+        return intField;
+    }
+
+    public void setIntField(int intField) {
+        this.intField = intField;
+    }
 }
 
 interface FooInterface {

Reply via email to