use of org.springframework.web.bind.WebDataBinder in project spring-framework by spring-projects.
the class ErrorsMethodHandlerArgumentResolverTests method setUp.
@Before
public void setUp() throws Exception {
paramErrors = new MethodParameter(getClass().getDeclaredMethod("handle", Errors.class), 0);
bindingResult = new WebDataBinder(new Object(), "attr").getBindingResult();
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
use of org.springframework.web.bind.WebDataBinder in project spring-framework by spring-projects.
the class InitBinderBindingContextTests method createBinderWithGlobalInitialization.
@Test
public void createBinderWithGlobalInitialization() throws Exception {
ConversionService conversionService = new DefaultFormattingConversionService();
bindingInitializer.setConversionService(conversionService);
ServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
BindingContext context = createBindingContext("initBinder", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, null);
assertSame(conversionService, dataBinder.getConversionService());
}
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 {
ServerWebExchange exchange = MockServerHttpRequest.get("/path?requestParam=22").toExchange();
ReactiveAdapterRegistry adapterRegistry = new ReactiveAdapterRegistry();
this.argumentResolvers.add(new RequestParamMethodArgumentResolver(null, adapterRegistry, false));
BindingContext context = createBindingContext("initBinderTypeConversion", WebDataBinder.class, int.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, "foo");
assertNotNull(dataBinder.getDisallowedFields());
assertEquals("requestParam-22", dataBinder.getDisallowedFields()[0]);
}
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 {
ServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
BindingContext context = createBindingContext("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, null);
assertNull(dataBinder.getDisallowedFields());
}
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 {
ServerWebExchange exchange = MockServerHttpRequest.get("/").toExchange();
BindingContext context = createBindingContext("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = context.createDataBinder(exchange, null, "invalidName");
assertNull(dataBinder.getDisallowedFields());
}
Aggregations