@Test public void handleInterfaceAnnotationShouldMergePlaceholdersAndSetParamsTypeAndNameAndDefaultValue() throws Exception { when(mockInterfaceConfigBuilder.startMethodsExtraParamConfig()) .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.handleInterfaceAnnotation(mockAnnotation, mockInterfaceConfigBuilder); verify(mockInterfaceConfigBuilder).startMethodsExtraParamConfig(); 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(); }
@Test public void handleMethodAnnotationShouldSetParamsTypeAndName() 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("a"); when(mockAnnotation.defaultValue()).thenReturn(""); when(mockAnnotation.contentType()).thenReturn(""); when(mockAnnotation.fileName()).thenReturn(""); toTest.handleMethodAnnotation(mockAnnotation, mockMethodConfigBuilder); verify(mockMethodConfigBuilder).startExtraParamConfig(); verify(mockParamConfigBuilder).setType(ParamType.FORM); verify(mockParamConfigBuilder).setName("a"); verify(mockParamConfigBuilder).setDefaultValue(null); verify(mockParamConfigBuilder).setMetaDatas(MultiParts.toMetaDatas(null, null)); verify(mockAnnotation).value(); verify(mockAnnotation).defaultValue(); verify(mockAnnotation).contentType(); verify(mockAnnotation).fileName(); }