SecureInterceptor { org.ocelotds.security.InvocationContext checkAccess(InvocationContext ctx, SecureProvider secureProvider, String[] roles) throws IllegalAccessException { if (secureProvider != null) { org.ocelotds.security.InvocationContext ic = new org.ocelotds.security.InvocationContext(ctx.getMethod(), ctx.getParameters()); secureProvider.checkAccess(ic, roles); return ic; } return null; }  @AroundInvoke Object processSecure(InvocationContext ctx);  }
@Test public void checkAccessTest() throws IllegalAccessException, Exception { System.out.println("checkAccess"); InvocationContext ctx = getCtx(); MySecureProvider secureProvider = mock(MySecureProvider.class); doNothing().when(secureProvider).checkAccess( any(org.ocelotds.security.InvocationContext.class), any(String[].class)); org.ocelotds.security.InvocationContext ic = instance.checkAccess(ctx, null, new String[] {"ROLE1", "ROLE2"}); assertThat(ic).isNull(); ic = instance.checkAccess(getCtx(), secureProvider, new String[] {"ROLE1", "ROLE2"}); assertThat(ic.getMethod()).isEqualTo(ctx.getMethod()); verify(secureProvider).checkAccess(eq(ic), any(String[].class)); }