ApiAnnotationConfig { public void setClientIdsIfSpecified(String[] clientIds) { if (!AnnotationUtil.isUnspecified(clientIds)) { config.setClientIds(Arrays.asList(clientIds)); } } ApiAnnotationConfig(ApiConfig config); ApiConfig getConfig(); void setRootIfNotEmpty(String root); void setNameIfNotEmpty(String name); void setCanonicalNameIfNotEmpty(String canonicalName); void setVersionIfNotEmpty(String version); void setTitleIfNotEmpty(String title); void setDescriptionIfNotEmpty(String description); void setDocumentationLinkIfNotEmpty(String documentationLink); void setBackendRootIfNotEmpty(String backendRoot); void setIsAbstractIfSpecified(AnnotationBoolean isAbstract); void setIsDefaultVersionIfSpecified(AnnotationBoolean defaultVersion); void setIsDiscoverableIfSpecified(AnnotationBoolean discoverable); void setUseDatastoreIfSpecified(AnnotationBoolean useDatastore); void setResourceIfNotEmpty(String resource); void setAuthLevelIfSpecified(AuthLevel authLevel); void setScopesIfSpecified(String[] scopes); void setAudiencesIfSpecified(String[] audiences); void setIssuersIfSpecified(ApiIssuerConfigs issuers); void setIssuerAudiencesIfSpecified(ApiIssuerAudienceConfig issuerAudiences); void setClientIdsIfSpecified(String[] clientIds); void setAuthenticatorsIfSpecified(Class<? extends Authenticator>[] authenticators); void setPeerAuthenticatorsIfSpecified(
      Class<? extends PeerAuthenticator>[] peerAuthenticators); void setApiKeyRequiredIfSpecified(AnnotationBoolean apiKeyRequired); void setApiLimitMetrics(ApiLimitMetric[] apiLimitMetrics);  }
@Test public void testSetClientIdsIfSpecified() throws Exception { String[] clientIds = { "foo", "bar" }; annotationConfig.setClientIdsIfSpecified(clientIds); assertEquals(Arrays.asList(clientIds), config.getClientIds()); ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(getResultNoParamsMethod()); assertEquals(Arrays.asList(clientIds), methodConfig.getClientIds()); }
@Test public void testSetClientIdsIfSpecified_empty() throws Exception { String[] empty = {}; annotationConfig.setClientIdsIfSpecified(empty); EndpointMethod method = getResultNoParamsMethod(); ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method); assertEquals(Collections.emptyList(), methodConfig.getClientIds()); String[] clientIds = { "bleh", "more bleh" }; annotationConfig.setClientIdsIfSpecified(clientIds); annotationConfig.setClientIdsIfSpecified(empty); assertEquals(Collections.emptyList(), config.getClientIds()); }