FlattrAuthenticator { protected String buildScopeString() { StringBuilder sb = new StringBuilder(); if (scope.contains(Scope.FLATTR )) sb.append(" flattr"); if (scope.contains(Scope.THING )) sb.append(" thing"); if (scope.contains(Scope.EMAIL )) sb.append(" email"); if (scope.contains(Scope.EXTENDEDREAD)) sb.append(" extendedread"); return sb.toString().trim(); } FlattrAuthenticator(ConsumerKey consumerKey);  FlattrAuthenticator(String key, String secret); String getRequestTokenUrl(); void setRequestTokenUrl(String requestTokenUrl); String getAccessTokenUrl(); void setAccessTokenUrl(String accessTokenUrl); String getCallbackUrl(); void setCallbackUrl(String callbackUrl); EnumSet<Scope> getScope(); void setScope(EnumSet<Scope> scope); void setResponseType(String responseType); String getResponseType(); String authenticate(); AccessToken fetchAccessToken(String code);  }
@Test public void testBuildScopeString() { ConsumerKey ck = new ConsumerKey("ck-abc", "ck-123"); FlattrAuthenticator auth = new FlattrAuthenticator(ck); auth.getScope().add(Scope.FLATTR); assertThat(auth.buildScopeString(), is("flattr")); auth.getScope().add(Scope.THING); assertThat(auth.buildScopeString(), is("flattr thing")); auth.getScope().clear(); assertThat(auth.buildScopeString(), isEmptyString()); auth.setScope(EnumSet.allOf(Scope.class)); assertThat(auth.buildScopeString(), is("flattr thing email extendedread")); auth.setScope(EnumSet.noneOf(Scope.class)); assertThat(auth.buildScopeString(), isEmptyString()); }