@Test public void should_Throw_When_PrivateMethodIsPassed() throws Exception { class Test { private void test() { } } Method method = Test.class.getDeclaredMethod("test"); exception.expect(IllegalArgumentException.class); exception.expectMessage(method.toString()); checker.getSecurityTarget(method); }
public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); } }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  String check(Method method); AnnotatedElement getSecurityTarget(Method method); }
VaadinConnectAccessChecker { public AnnotatedElement getSecurityTarget(Method method) { if (!Modifier.isPublic(method.getModifiers())) { throw new IllegalArgumentException(String.format( "The method '%s' is not public hence cannot have a security target", method)); } return hasSecurityAnnotation(method) ? method : method.getDeclaringClass(); }  String check(Method method); AnnotatedElement getSecurityTarget(Method method);  }