@Test public void testFilteringScopes() throws Exception { Annotation[] annotations; Set<String> expected; annotations = new Annotation[0]; assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(Collections.<String>emptySet())); annotations = new Annotation[] {CustomAnnotationLiteral.INSTANCE, CustomAnnotationLiteral.INSTANCE}; assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(Collections.<String>emptySet())); annotations = new Annotation[] {CustomAnnotationLiteral.INSTANCE, SecurityAnnotations .rolesAllowed("manager"), CustomAnnotationLiteral.INSTANCE}; expected = Collections.singleton(RolesAllowed.class.getName() + "_manager"); assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(expected)); annotations = new Annotation[] {SecurityAnnotations.rolesAllowed("manager", "user")}; expected = Arrays.asList(RolesAllowed.class.getName() + "_manager", RolesAllowed.class.getName() + "_user") .stream() .collect(Collectors.toSet()); assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(expected)); annotations = new Annotation[] {SecurityAnnotations.permitAll()}; assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(FilteringHelper.getDefaultFilteringScope())); annotations = new Annotation[] {SecurityAnnotations.denyAll()}; assertThat(SecurityHelper.getFilteringScopes(annotations), equalTo(null)); }
static Set<String> getFilteringScopes(final Annotation[] annotations) { return getFilteringScopes(null, annotations); }
SecurityHelper { static Set<String> getFilteringScopes(final Annotation[] annotations) { return getFilteringScopes(null, annotations); } }
SecurityHelper { static Set<String> getFilteringScopes(final Annotation[] annotations) { return getFilteringScopes(null, annotations); } private  SecurityHelper(); }
SecurityHelper { static Set<String> getFilteringScopes(final Annotation[] annotations) { return getFilteringScopes(null, annotations); } private  SecurityHelper();  }
SecurityHelper { static Set<String> getFilteringScopes(final Annotation[] annotations) { return getFilteringScopes(null, annotations); } private  SecurityHelper();   }