### Question:
LocalAuthoritiesExtractor implements AuthoritiesExtractor { @Override public Collection<GrantedAuthority> getAuthorities(XsuaaToken jwt) { Set<String> scopeAuthorities = new HashSet<>(); scopeAuthorities.addAll(getScopes(jwt, appId)); Stream<String> authorities = Stream.of(scopeAuthorities).flatMap(Collection::stream); return authorities.map(SimpleGrantedAuthority::new).collect(Collectors.toList()); } LocalAuthoritiesExtractor(String appId); @Override Collection<GrantedAuthority> getAuthorities(XsuaaToken jwt);  }### Answer:
@Test public void extractLocalScopes() { assertThat(cut.getAuthorities(token)).containsExactlyInAnyOrder( new SimpleGrantedAuthority("Scope1"), new SimpleGrantedAuthority("Scope2")); }