### Question:
ScopeService { public boolean scopeAllowed(String scope, String allowedScopes) { String [] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String [] scopes = scope.split(SPACE); int allowedCount = 0; for(String s : scopes) { if (allowedList.contains(s)) { allowedCount++; } } return (allowedCount == scopes.length); }  String registerScope(HttpRequest req); String getScopes(HttpRequest req); String getValidScope(String scope, String clientId); String getValidScopeByScope(String scope, String storedScope); boolean scopeAllowed(String scope, String allowedScopes); int getExpiresIn(String tokenGrantType, String scope); String updateScope(HttpRequest req, String scopeName); String deleteScope(String scopeName); String getScopeByName(String scopeName);  }### Answer:
@Test public void when_scope_is_contained_return_true() throws Exception { String scope = "extended"; String scopeList = "basic extended"; boolean allowed = service.scopeAllowed(scope, scopeList); assertTrue(allowed); }
@Test public void when_scope_is_not_contained_return_false() throws Exception { String scope = "payment"; String scopeList = "basic,extended"; boolean allowed = service.scopeAllowed(scope, scopeList); assertFalse(allowed); }
@Test public void when_scope_contains_two_scopes_check_all() throws Exception { String scope = "basic extended"; String scopeList = "basic extended"; boolean allowed = service.scopeAllowed(scope, scopeList); assertTrue(allowed); }