AuthScopeExpressions { public static List<String> encode(AuthScopeExpression authScopeExpression) { try { return ((AbstractAuthScopeExpression) authScopeExpression).encode(); } catch (ClassCastException e) { throw new IllegalArgumentException( "Expressions of type " + authScopeExpression.getClass() + " are not supported."); } } private  AuthScopeExpressions(); static AuthScopeExpression interpret(String... scopes); static AuthScopeExpression interpret(List<String> scopes); static List<String> encode(AuthScopeExpression authScopeExpression); static List<String> encodeMutable(AuthScopeExpression authScopeExpression);  }
@Test public void testEncodeSingleScope() { assertEquals(ImmutableList.of("scope_1"), AuthScopeExpressions.encode(new SingleAuthScopeExpression("scope_1"))); }
@Test public void testEncodeDisjunctScope() { assertEquals(ImmutableList.of("scope_1", "scope_2", "scope_3"), AuthScopeExpressions.encode( new DisjunctAuthScopeExpression(ImmutableList.<AbstractAuthScopeExpression>of( new SingleAuthScopeExpression("scope_1"), new SingleAuthScopeExpression("scope_2"), new SingleAuthScopeExpression("scope_3"))))); }
@Test public void testEncodeConjunctScope() { assertEquals(ImmutableList.of("scope_1 scope_2 scope_3"), AuthScopeExpressions.encode( new ConjunctAuthScopeExpression(ImmutableList.<SingleAuthScopeExpression>of( new SingleAuthScopeExpression("scope_1"), new SingleAuthScopeExpression("scope_2"), new SingleAuthScopeExpression("scope_3"))))); }
@Test public void testEncodeComplexScope() { assertEquals(ImmutableList.of("scope_1 scope_2", "scope_1 scope_3"), AuthScopeExpressions.encode( new DisjunctAuthScopeExpression(ImmutableList.<AbstractAuthScopeExpression>of( new ConjunctAuthScopeExpression(ImmutableList.<SingleAuthScopeExpression>of( new SingleAuthScopeExpression("scope_1"), new SingleAuthScopeExpression("scope_2"))), new ConjunctAuthScopeExpression(ImmutableList.<SingleAuthScopeExpression>of( new SingleAuthScopeExpression("scope_1"), new SingleAuthScopeExpression("scope_3"))))))); }