String fieldToAccess = scope + "Field";
String expectMsg = "Class " + INVOKER_CLASS_NAME + " " + "can not access a member of class " + targetClass.dottedtypename
+ " " + "with modifiers \"" + (scope.equals("default") ? "" : scope) + "\"";
//First... we do set the Access flag, it should work!
Result r = runOnInstance(callerClazz, callerInstance, "getFieldWithAccess", targetClass.getClazz(), fieldToAccess, true);
Assert.assertEquals(r.returnValue, fieldToAccess + " value");
//Then... we do not set the Access flag, it should fail!
try {
r = runOnInstance(callerClazz, callerInstance, "getFieldWithAccess", targetClass.getClazz(), fieldToAccess, false);