### Question:
XsuaaScopeConverter implements ScopeConverter { @Override public Set<String> convert(Collection<String> scopes) { Set<String> convertedScopes = new LinkedHashSet<>(); for (String scope : scopes) { String convertedScope = convertToLocalScope(scope); if (convertedScope != null) { convertedScopes.add(convertedScope); } } return convertedScopes; } XsuaaScopeConverter(String appId); @Override Set<String> convert(Collection<String> scopes);  }### Answer:
@Test public void oneLocalScope() { Collection<String> scope = newArrayList("myAppId!t1785.Read"); Collection<String> translatedScope = cut.convert(scope); assertThat(translatedScope).containsExactly("Read"); }
@Test public void ignoresOtherLocalScopes() { Collection<String> scope = newArrayList("myAppId!t1785.Read", "Display", "Read"); Collection<String> translatedScope = cut.convert(scope); assertThat(translatedScope).containsExactly("Read"); }
@Test public void scopeContainsDotAndUnderscoreAsNamespace() { Collection<String> scope = newArrayList("myAppId!t1785.Read.Context", "myAppId!t1785.Write.Context"); Collection<String> translatedScope = cut.convert(scope); assertThat(translatedScope).containsExactly("Read.Context", "Write.Context"); }
@Test public void noScopes_emptyCollection() { Collection<String> scope = newArrayList(); Collection<String> translatedScope = cut.convert(scope); assertThat(translatedScope).isEmpty(); }