AuthorizationFeature implements DynamicFeature { protected boolean isSuperAdminOnly(Method method) { Annotation[][] allAnnotations = annotationLocator.getParameterAnnotations(method); for (int i = 0; i < allAnnotations.length; i++) { for (Annotation a : allAnnotations[i]) { if (a instanceof Verify) { return false; } } } return true; } @Inject  AuthorizationFeature(VerifyAuthorizationFilter authorizationFilter,
        SuperAdminAuthorizationFilter superAdminFilter,
        SecurityHoleAuthorizationFilter securityHoleFilter,
        AnnotationLocator annotationLocator); @Override void configure(ResourceInfo resourceInfo, FeatureContext context);  }
@Test public void testVerifyIsNotSuperAdminOnly() throws Exception { Method m = FakeResource.class.getMethod("methodWithVerify", String.class); boolean isSuperAdminOnly = authorizationFeature.isSuperAdminOnly(m); assertEquals(false, isSuperAdminOnly); }
@Test public void testIsSuperAdminOnly() throws Exception { Method m = FakeResource.class.getMethod("superAdminOnlyMethod", String.class); boolean isSuperAdminOnly = authorizationFeature.isSuperAdminOnly(m); assertEquals(true, isSuperAdminOnly); }
@Test public void testSpecFirstVerifyIsNotSuperAdminOnly() throws Exception { Method m = FakeApi.class.getMethod("methodWithVerify", String.class); boolean isSuperAdminOnly = authorizationFeature.isSuperAdminOnly(m); assertEquals(false, isSuperAdminOnly); }
@Test public void testSpecFirstIsSuperAdminOnly() throws Exception { Method m = FakeApi.class.getMethod("superAdminOnlyMethod", String.class); boolean isSuperAdminOnly = authorizationFeature.isSuperAdminOnly(m); assertEquals(true, isSuperAdminOnly); }