@Test public void scopesMatch() { Set<String> expected = Sets.newHashSet("foo", "bar", "baz"); Set<String> actualGood = Sets.newHashSet("foo", "baz", "bar"); Set<String> actualGood2 = Sets.newHashSet("foo", "bar"); Set<String> actualBad = Sets.newHashSet("foo", "bob", "bar"); assertThat(service.scopesMatch(expected, actualGood), is(true)); assertThat(service.scopesMatch(expected, actualGood2), is(true)); assertThat(service.scopesMatch(expected, actualBad), is(false)); }
@Override public boolean scopesMatch(Set<String> expected, Set<String> actual) { Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> act = fromStrings(actual); for (SystemScope actScope : act) { if (!ex.contains(actScope)) { return false; } else { } } return true; }
DefaultSystemScopeService implements SystemScopeService { @Override public boolean scopesMatch(Set<String> expected, Set<String> actual) { Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> act = fromStrings(actual); for (SystemScope actScope : act) { if (!ex.contains(actScope)) { return false; } else { } } return true; } }
DefaultSystemScopeService implements SystemScopeService { @Override public boolean scopesMatch(Set<String> expected, Set<String> actual) { Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> act = fromStrings(actual); for (SystemScope actScope : act) { if (!ex.contains(actScope)) { return false; } else { } } return true; }  }
DefaultSystemScopeService implements SystemScopeService { @Override public boolean scopesMatch(Set<String> expected, Set<String> actual) { Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> act = fromStrings(actual); for (SystemScope actScope : act) { if (!ex.contains(actScope)) { return false; } else { } } return true; }  @Override Set<SystemScope> getAll(); @Override SystemScope getById(Long id); @Override SystemScope getByValue(String value); @Override void remove(SystemScope scope); @Override SystemScope save(SystemScope scope); @Override Set<SystemScope> fromStrings(Set<String> scope); @Override Set<String> toStrings(Set<SystemScope> scope); @Override boolean scopesMatch(Set<String> expected, Set<String> actual); @Override Set<SystemScope> getDefaults(); @Override Set<SystemScope> getReserved(); @Override Set<SystemScope> getRestricted(); @Override Set<SystemScope> getUnrestricted(); @Override Set<SystemScope> removeRestrictedAndReservedScopes(Set<SystemScope> scopes); @Override Set<SystemScope> removeReservedScopes(Set<SystemScope> scopes); }
DefaultSystemScopeService implements SystemScopeService { @Override public boolean scopesMatch(Set<String> expected, Set<String> actual) { Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> act = fromStrings(actual); for (SystemScope actScope : act) { if (!ex.contains(actScope)) { return false; } else { } } return true; }  @Override Set<SystemScope> getAll(); @Override SystemScope getById(Long id); @Override SystemScope getByValue(String value); @Override void remove(SystemScope scope); @Override SystemScope save(SystemScope scope); @Override Set<SystemScope> fromStrings(Set<String> scope); @Override Set<String> toStrings(Set<SystemScope> scope); @Override boolean scopesMatch(Set<String> expected, Set<String> actual); @Override Set<SystemScope> getDefaults(); @Override Set<SystemScope> getReserved(); @Override Set<SystemScope> getRestricted(); @Override Set<SystemScope> getUnrestricted(); @Override Set<SystemScope> removeRestrictedAndReservedScopes(Set<SystemScope> scopes); @Override Set<SystemScope> removeReservedScopes(Set<SystemScope> scopes);  }