@Test public void handleMethodAnnotationShouldMergePlaceholdersSetParamsTypeAndNameAndDefaultValue() throws Exception { when(mockMethodConfigBuilder.startExtraParamConfig()).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setType(any(ParamType.class))).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setName(any(String.class))).thenReturn(mockParamConfigBuilder); when(mockAnnotation.value()).thenReturn(VAL_WITH_PH + "a"); when(mockAnnotation.defaultValue()).thenReturn(VAL_WITH_PH +"b"); toTest.handleMethodAnnotation(mockAnnotation, mockMethodConfigBuilder); verify(mockMethodConfigBuilder).startExtraParamConfig(); verify(mockParamConfigBuilder).setType(ParamType.QUERY); verify(mockParamConfigBuilder).setName(EXPECTED_MERGE_VAL + "a"); verify(mockParamConfigBuilder).setDefaultValue(EXPECTED_MERGE_VAL + "b"); verify(mockAnnotation).value(); verify(mockAnnotation).defaultValue(); }
@Override public void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(QUERY) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))); }
QueryParamAnnotationHandler extends ParamAnnotationHandler<QueryParam> { @Override public void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(QUERY) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))); } }
QueryParamAnnotationHandler extends ParamAnnotationHandler<QueryParam> { @Override public void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(QUERY) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))); } QueryParamAnnotationHandler(CRestConfig crestConfig); }
QueryParamAnnotationHandler extends ParamAnnotationHandler<QueryParam> { @Override public void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(QUERY) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))); } QueryParamAnnotationHandler(CRestConfig crestConfig); @Override void handleInterfaceAnnotation(QueryParam annotation, InterfaceConfigBuilder builder); @Override void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder); @Override void handleParameterAnnotation(QueryParam annotation, ParamConfigBuilder builder); }
QueryParamAnnotationHandler extends ParamAnnotationHandler<QueryParam> { @Override public void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(QUERY) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))); } QueryParamAnnotationHandler(CRestConfig crestConfig); @Override void handleInterfaceAnnotation(QueryParam annotation, InterfaceConfigBuilder builder); @Override void handleMethodAnnotation(QueryParam annotation, MethodConfigBuilder builder); @Override void handleParameterAnnotation(QueryParam annotation, ParamConfigBuilder builder);  }