AuthServicePluginUtils { public static GroupFilter createGroupFilter(List<GroupResponse> groups) { List<String> allowed = new ArrayList<>(); allowed.addAll(groups.stream().map(GroupResponse::getName).collect(Collectors.toList())); return (groupName) -> { return !allowed.contains(groupName); }; } private  AuthServicePluginUtils(); static RoleFilter createRoleFilter(List<RoleResponse> roles, List<GroupResponse> groups); static GroupFilter createGroupFilter(List<GroupResponse> groups);  }
@Test public void testGroupFilter() { List<GroupResponse> groups = new ArrayList<>(); groups.add(new GroupResponse().setName("group")); GroupFilter filter = AuthServicePluginUtils.createGroupFilter(groups); assertFalse(filter.filter("group")); assertTrue(filter.filter("group1")); }