Search in sources :

Example 26 with EndpointMethod

use of com.google.api.server.spi.EndpointMethod in project endpoints-java by cloudendpoints.

the class ApiAnnotationConfigTest method testSetAudiencesIfSpecified_empty.

@Test
public void testSetAudiencesIfSpecified_empty() throws Exception {
    String[] empty = {};
    annotationConfig.setAudiencesIfSpecified(empty);
    EndpointMethod method = getResultNoParamsMethod();
    ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method);
    assertEquals(Collections.emptyList(), methodConfig.getAudiences());
    String[] audiences = { "bleh", "more bleh" };
    annotationConfig.setAudiencesIfSpecified(audiences);
    annotationConfig.setAudiencesIfSpecified(empty);
    assertEquals(Collections.emptyList(), config.getAudiences());
}
Also used : ApiMethodConfig(com.google.api.server.spi.config.model.ApiMethodConfig) EndpointMethod(com.google.api.server.spi.EndpointMethod) Test(org.junit.Test)

Aggregations

EndpointMethod (com.google.api.server.spi.EndpointMethod)26 ApiMethodConfig (com.google.api.server.spi.config.model.ApiMethodConfig)14 Test (org.junit.Test)14 Method (java.lang.reflect.Method)6 Annotation (java.lang.annotation.Annotation)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 Named (com.google.api.server.spi.config.Named)2 Nullable (com.google.api.server.spi.config.Nullable)2 ApiParameterConfig (com.google.api.server.spi.config.model.ApiParameterConfig)2 BadRequestException (com.google.api.server.spi.response.BadRequestException)2 TypeToken (com.google.common.reflect.TypeToken)2 Map (java.util.Map)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 MethodHierarchyReader (com.google.api.server.spi.MethodHierarchyReader)1 TypeLoader (com.google.api.server.spi.TypeLoader)1 EndpointsAuthenticator (com.google.api.server.spi.auth.EndpointsAuthenticator)1 EndpointsPeerAuthenticator (com.google.api.server.spi.auth.EndpointsPeerAuthenticator)1 User (com.google.api.server.spi.auth.common.User)1 Authenticator (com.google.api.server.spi.config.Authenticator)1