ApiClassAnnotationConfig { public void setScopesIfSpecified(String[] scopes) { if (!AnnotationUtil.isUnspecified(scopes)) { config.setScopeExpression(AuthScopeExpressions.interpret(scopes)); } } ApiClassAnnotationConfig(ApiClassConfig config); void setResourceIfNotEmpty(String resource); 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 setUseDatastoreIfSpecified(AnnotationBoolean useDatastore); void setApiKeyRequiredIfSpecified(AnnotationBoolean apiKeyRequired);  }
@Test public void testSetScopesIfSpecified() throws Exception { String[] scopes = { "foo", "bar" }; annotationConfig.setScopesIfSpecified(scopes); Mockito.verify(config).setScopeExpression(toScopeExpression(scopes)); }
@Test public void testSetScopesIfSpecified_empty() throws Exception { String[] empty = {}; annotationConfig.setScopesIfSpecified(empty); Mockito.verify(config).setScopeExpression(toScopeExpression()); }
@Test public void testSetScopesIfSpecified_unspecified() throws Exception { annotationConfig.setScopesIfSpecified(null); Mockito.verifyZeroInteractions(config); String[] unspecified = {Api.UNSPECIFIED_STRING_FOR_LIST}; annotationConfig.setScopesIfSpecified(unspecified); Mockito.verifyZeroInteractions(config); String[] scopes = { "bleh", "more bleh" }; annotationConfig.setScopesIfSpecified(scopes); annotationConfig.setScopesIfSpecified(unspecified); Mockito.verify(config).setScopeExpression(toScopeExpression(scopes)); Mockito.verifyNoMoreInteractions(config); }