@Test public void handleMethodAnnotationShouldMergePlaceholdersAndSetParamsTypeAndNameAndDefaultValue() throws Exception { when(mockMethodConfigBuilder.startExtraParamConfig()).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setType(any(ParamType.class))).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setName(any(String.class))).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setDefaultValue(anyString())).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setMetaDatas(any(Map.class))).thenReturn(mockParamConfigBuilder); when(mockAnnotation.value()).thenReturn(VAL_WITH_PH + "a"); when(mockAnnotation.defaultValue()).thenReturn(VAL_WITH_PH + "b"); when(mockAnnotation.contentType()).thenReturn(VAL_WITH_PH + "c"); when(mockAnnotation.fileName()).thenReturn(VAL_WITH_PH + "d"); toTest.handleMethodAnnotation(mockAnnotation, mockMethodConfigBuilder); verify(mockMethodConfigBuilder).startExtraParamConfig(); verify(mockParamConfigBuilder).setType(ParamType.FORM); verify(mockParamConfigBuilder).setName(EXPECTED_MERGE_VAL + "a"); verify(mockParamConfigBuilder).setDefaultValue(EXPECTED_MERGE_VAL + "b"); verify(mockParamConfigBuilder).setMetaDatas(MultiParts.toMetaDatas(EXPECTED_MERGE_VAL + "c", EXPECTED_MERGE_VAL + "d")); verify(mockAnnotation).value(); verify(mockAnnotation).defaultValue(); verify(mockAnnotation).contentType(); verify(mockAnnotation).fileName(); }
@Override public void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(FORM) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))) .setMetaDatas(MultiParts.toMetaDatas(nullIfUnset(ph(annotation.contentType())), nullIfUnset(ph(annotation.fileName())))); }
MultiPartParamAnnotationHandler extends ParamAnnotationHandler<MultiPartParam> { @Override public void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(FORM) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))) .setMetaDatas(MultiParts.toMetaDatas(nullIfUnset(ph(annotation.contentType())), nullIfUnset(ph(annotation.fileName())))); } }
MultiPartParamAnnotationHandler extends ParamAnnotationHandler<MultiPartParam> { @Override public void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(FORM) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))) .setMetaDatas(MultiParts.toMetaDatas(nullIfUnset(ph(annotation.contentType())), nullIfUnset(ph(annotation.fileName())))); } MultiPartParamAnnotationHandler(CRestConfig crestConfig); }
MultiPartParamAnnotationHandler extends ParamAnnotationHandler<MultiPartParam> { @Override public void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(FORM) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))) .setMetaDatas(MultiParts.toMetaDatas(nullIfUnset(ph(annotation.contentType())), nullIfUnset(ph(annotation.fileName())))); } MultiPartParamAnnotationHandler(CRestConfig crestConfig); @Override void handleInterfaceAnnotation(MultiPartParam annotation, InterfaceConfigBuilder builder); @Override void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder); @Override void handleParameterAnnotation(MultiPartParam annotation, ParamConfigBuilder builder); }
MultiPartParamAnnotationHandler extends ParamAnnotationHandler<MultiPartParam> { @Override public void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder) { builder.startExtraParamConfig() .setType(FORM) .setName(ph(annotation.value())) .setDefaultValue(nullIfUnset(ph(annotation.defaultValue()))) .setMetaDatas(MultiParts.toMetaDatas(nullIfUnset(ph(annotation.contentType())), nullIfUnset(ph(annotation.fileName())))); } MultiPartParamAnnotationHandler(CRestConfig crestConfig); @Override void handleInterfaceAnnotation(MultiPartParam annotation, InterfaceConfigBuilder builder); @Override void handleMethodAnnotation(MultiPartParam annotation, MethodConfigBuilder builder); @Override void handleParameterAnnotation(MultiPartParam annotation, ParamConfigBuilder builder);  }