Skip to content

Commit

Permalink
Adds additional use case to check access to values of int type
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Mar 7, 2015
1 parent 54c6423 commit 4f0f7d1
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,28 @@ public void testAllowStaticAccessIfClassIsNotExcluded() throws Exception {
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;
}
Expand All @@ -312,6 +328,13 @@ public int hashCode() {
return 1;
}

public int getIntField() {
return intField;
}

public void setIntField(int intField) {
this.intField = intField;
}
}

interface FooInterface {
Expand Down

0 comments on commit 4f0f7d1

Please sign in to comment.