コード例 #1
0
 @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();
 }
コード例 #2
0
 @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();
 }
コード例 #3
0
 @Test
 public void handleParameterAnnotationShouldSetTypeAndNameAndDefaultValue() throws Exception {
   when(super.mockParamConfigBuilder.setType(any(ParamType.class)))
       .thenReturn(super.mockParamConfigBuilder);
   when(super.mockParamConfigBuilder.setName(any(String.class)))
       .thenReturn(super.mockParamConfigBuilder);
   when(super.mockParamConfigBuilder.setDefaultValue(anyString()))
       .thenReturn(super.mockParamConfigBuilder);
   when(super.mockParamConfigBuilder.setMetaDatas(any(Map.class)))
       .thenReturn(super.mockParamConfigBuilder);
   when(mockAnnotation.value()).thenReturn("a");
   when(mockAnnotation.defaultValue()).thenReturn("b");
   when(mockAnnotation.contentType()).thenReturn("c");
   when(mockAnnotation.fileName()).thenReturn("d");
   toTest.handleParameterAnnotation(mockAnnotation, super.mockParamConfigBuilder);
   verify(super.mockParamConfigBuilder).setType(ParamType.FORM);
   verify(super.mockParamConfigBuilder).setName("a");
   verify(super.mockParamConfigBuilder).setDefaultValue("b");
   verify(super.mockParamConfigBuilder).setMetaDatas(MultiParts.toMetaDatas("c", "d"));
   verify(mockAnnotation).value();
   verify(mockAnnotation).defaultValue();
   verify(mockAnnotation).contentType();
   verify(mockAnnotation).fileName();
 }