ShiroAuthorizingParamInterceptor implements MethodInterceptor { @VisibleForTesting LoadingCache<Method, Function<Object[], Optional<JobKey>>> getAuthorizingParamGetters() { return authorizingParamGetters; }  @Override Object invoke(MethodInvocation invocation);  }
@Test public void testHandlesAllDecoratedParamTypes() { control.replay(); for (Method method : AnnotatedAuroraAdmin.class.getMethods()) { if (HttpSecurityModule.AURORA_SCHEDULER_MANAGER_SERVICE.matches(method)) { interceptor.getAuthorizingParamGetters().getUnchecked(method); } } }
@Test public void testHandlesMultipleAnnotations() { control.replay(); Function<Object[], Optional<JobKey>> func = interceptor.getAuthorizingParamGetters().getUnchecked(Params.class.getMethods()[0]); func.apply(new Object[]{null, new JobKey(), null}); func.apply(new Object[]{null, null, new JobUpdateRequest()}); }
@Test(expected = IllegalStateException.class) public void testThrowsOnMultipleNonNullArguments() { control.replay(); Function<Object[], Optional<JobKey>> func = interceptor.getAuthorizingParamGetters().getUnchecked(Params.class.getMethods()[0]); func.apply(new Object[]{new JobConfiguration(), new JobKey(), null}); }
@Test(expected = UncheckedExecutionException.class) public void testThrowsNoAuthParams() { control.replay(); interceptor.getAuthorizingParamGetters().getUnchecked(NoParams.class.getMethods()[0]); }
@Test(expected = UncheckedExecutionException.class) public void testThrowsNoResponseReturned() { control.replay(); interceptor.getAuthorizingParamGetters().getUnchecked(NoResponse.class.getMethods()[0]); }