use of cn.taketoday.http.converter.AllEncompassingFormHttpMessageConverter in project today-framework by TAKETODAY.
the class RequestResponseBodyMethodProcessorTests method resolveArgumentRawTypeFromParameterizedType.
@Test
public void resolveArgumentRawTypeFromParameterizedType() throws Throwable {
String content = "fruit=apple&vegetable=kale";
this.servletRequest.setMethod("GET");
this.servletRequest.setContent(content.getBytes(StandardCharsets.UTF_8));
this.servletRequest.setContentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE);
List<HttpMessageConverter<?>> converters = new ArrayList<>();
converters.add(new AllEncompassingFormHttpMessageConverter());
RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters);
@SuppressWarnings("unchecked") MultiValueMap<String, String> result = (MultiValueMap<String, String>) processor.resolveArgument(request, paramMultiValueMap);
assertThat(result).isNotNull();
assertThat(result.getFirst("fruit")).isEqualTo("apple");
assertThat(result.getFirst("vegetable")).isEqualTo("kale");
}
Aggregations