ApiMethodAnnotationConfig { public void setScopesIfSpecified(String[] scopes) { if (!AnnotationUtil.isUnspecified(scopes)) { config.setScopeExpression(AuthScopeExpressions.interpret(scopes)); } } ApiMethodAnnotationConfig(ApiMethodConfig config); ApiMethodConfig getConfig(); void setNameIfNotEmpty(String name); void setDescriptionIfNotEmpty(String description); void setPathIfNotEmpty(String path); void setHttpMethodIfNotEmpty(String httpMethod); void setAuthLevelIfSpecified(AuthLevel authLevel); void setScopesIfSpecified(String[] scopes); void setAudiencesIfSpecified(String[] audiences); void setIssuerAudiencesIfSpecified(ApiIssuerAudienceConfig issuerAudiences); void setClientIdsIfSpecified(String[] clientIds); void setAuthenticatorsIfSpecified(Class<? extends Authenticator>[] authenticators); void setPeerAuthenticatorsIfSpecified(
      Class<? extends PeerAuthenticator>[] peerAuthenticators); void setIgnoredIfSpecified(AnnotationBoolean ignored); void setApiKeyRequiredIfSpecified(AnnotationBoolean apiKeyRequired); void setMetricCosts(ApiMetricCost[] metricCosts);  }
@Test public void testSetScopesIfSpecified() throws Exception { String[] scopes = { "foo", "bar" }; annotationConfig.setScopesIfSpecified(scopes); assertEquals(toScopeExpression(scopes), config.getScopeExpression()); }
@Test public void testSetScopesIfSpecified_empty() throws Exception { String[] empty = {}; annotationConfig.setScopesIfSpecified(empty); assertEquals(toScopeExpression(), config.getScopeExpression()); String[] scopes = { "bleh", "more bleh" }; annotationConfig.setScopesIfSpecified(scopes); annotationConfig.setScopesIfSpecified(empty); assertEquals(toScopeExpression(), config.getScopeExpression()); }
@Test public void testSetScopesIfSpecified_unspecified() throws Exception { testDefaults(); annotationConfig.setScopesIfSpecified(null); testDefaults(); String[] unspecified = {Api.UNSPECIFIED_STRING_FOR_LIST}; annotationConfig.setScopesIfSpecified(unspecified); testDefaults(); String[] scopes = {"bleh", "more bleh"}; annotationConfig.setScopesIfSpecified(scopes); annotationConfig.setScopesIfSpecified(unspecified); assertEquals(toScopeExpression(scopes), config.getScopeExpression()); }