@Test(expected = AuthorizationException.class) public void test_or_permission_fail() throws Throwable { Mockito.when(subjectUnderTest.isPermitted("CODE")).thenReturn(false); Mockito.when(subjectUnderTest.isPermitted("EAT")).thenReturn(false); underTest = new RequiresPermissionsInterceptor(); MethodInvocation methodInvocation = Mockito.mock(MethodInvocation.class); when(methodInvocation.getMethod()) .thenReturn(RequiresPermissionsInterceptorTest.class.getMethod("securedOrMethod")); underTest.invoke(methodInvocation); }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { findAnnotation(invocation).ifPresent(rpAnnotation -> { checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical()); }); return invocation.proceed(); }
RequiresPermissionsInterceptor extends AbstractPermissionsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { findAnnotation(invocation).ifPresent(rpAnnotation -> { checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical()); }); return invocation.proceed(); } }
RequiresPermissionsInterceptor extends AbstractPermissionsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { findAnnotation(invocation).ifPresent(rpAnnotation -> { checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical()); }); return invocation.proceed(); }  }
RequiresPermissionsInterceptor extends AbstractPermissionsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { findAnnotation(invocation).ifPresent(rpAnnotation -> { checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical()); }); return invocation.proceed(); }  @Override Object invoke(MethodInvocation invocation); }
RequiresPermissionsInterceptor extends AbstractPermissionsInterceptor { @Override public Object invoke(MethodInvocation invocation) throws Throwable { findAnnotation(invocation).ifPresent(rpAnnotation -> { checkPermissions(invocation.getMethod(), rpAnnotation.value(), rpAnnotation.logical()); }); return invocation.proceed(); }  @Override Object invoke(MethodInvocation invocation);  }