Search in sources :

Example 6 with ParameterType

use of com.palantir.conjure.spec.ParameterType in project conjure by palantir.

the class ParamIdValidatorTest method testInvalidHeader.

@Test
public void testInvalidHeader() {
    for (String paramId : ImmutableList.of("authorization", "123", "Foo_Bar", "Foo.Bar")) {
        ParameterType parameterType = ParameterType.header(HeaderParameterType.of(ParameterId.of(paramId)));
        assertThatThrownByEndpointValidation(parameterType).isInstanceOf(IllegalStateException.class).hasMessage("Header parameter id %s on endpoint test{http: POST /a/path} must match pattern %s", paramId, EndpointDefinitionValidator.HEADER_PATTERN);
    }
}
Also used : ParameterType(com.palantir.conjure.spec.ParameterType) QueryParameterType(com.palantir.conjure.spec.QueryParameterType) HeaderParameterType(com.palantir.conjure.spec.HeaderParameterType) Test(org.junit.jupiter.api.Test)

Aggregations

ParameterType (com.palantir.conjure.spec.ParameterType)6 HeaderParameterType (com.palantir.conjure.spec.HeaderParameterType)4 QueryParameterType (com.palantir.conjure.spec.QueryParameterType)4 Test (org.junit.jupiter.api.Test)3 ParameterId (com.palantir.conjure.spec.ParameterId)2 AnnotationSpec (com.squareup.javapoet.AnnotationSpec)2 ImmutableList (com.google.common.collect.ImmutableList)1 ParameterName (com.palantir.conjure.parser.services.ParameterName)1 ArgumentDefinition (com.palantir.conjure.spec.ArgumentDefinition)1 ArgumentName (com.palantir.conjure.spec.ArgumentName)1 BodyParameterType (com.palantir.conjure.spec.BodyParameterType)1 Documentation (com.palantir.conjure.spec.Documentation)1 PathParameterType (com.palantir.conjure.spec.PathParameterType)1 ParameterSpec (com.squareup.javapoet.ParameterSpec)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1