use of org.springframework.web.bind.WebDataBinder in project spring-framework by spring-projects.
the class InitBinderBindingContextTests method createBinderTypeConversion.
@Test
public void createBinderTypeConversion() throws Exception {
MockServerHttpRequest request = MockServerHttpRequest.get("/path?requestParam=22").build();
MockServerWebExchange exchange = MockServerWebExchange.from(request);
ReactiveAdapterRegistry adapterRegistry = ReactiveAdapterRegistry.getSharedInstance();
this.argumentResolvers.add(new RequestParamMethodArgumentResolver(null, adapterRegistry, false));
BindingContext context = createBindingContext("initBinderTypeConversion", WebDataBinder.class, int.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, "foo");
assertThat(dataBinder.getDisallowedFields()).isNotNull();
assertThat(dataBinder.getDisallowedFields()[0]).isEqualTo("requestParam-22");
}
use of org.springframework.web.bind.WebDataBinder in project spring-framework by spring-projects.
the class InitBinderBindingContextTests method createBinderWithAttrNameNoMatch.
@Test
public void createBinderWithAttrNameNoMatch() throws Exception {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
BindingContext context = createBindingContext("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, "invalidName");
assertThat(dataBinder.getDisallowedFields()).isNull();
}
use of org.springframework.web.bind.WebDataBinder in project spring-framework by spring-projects.
the class InitBinderBindingContextTests method createBinderNullAttrName.
@Test
public void createBinderNullAttrName() throws Exception {
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/"));
BindingContext context = createBindingContext("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, null);
assertThat(dataBinder.getDisallowedFields()).isNull();
}
Aggregations