SingleAuthScopeExpression extends AbstractAuthScopeExpression { @Override public boolean isAuthorized(Set<String> userScopes) { return userScopes.contains(scope); } SingleAuthScopeExpression(String scope); @Override String[] getAllScopes(); @Override boolean isAuthorized(Set<String> userScopes); @Override String toLoggingForm(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testIsAuthorizedWithSuccess() { String scope = "some_scope"; SingleAuthScopeExpression expression = new SingleAuthScopeExpression(scope); assertTrue(expression.isAuthorized(ImmutableSet.of("scope0", scope))); }
@Test public void testIsAuthorizedWithFailure() { String scope = "some_scope"; SingleAuthScopeExpression expression = new SingleAuthScopeExpression(scope); assertFalse(expression.isAuthorized(ImmutableSet.of("scope0"))); }