use of org.springframework.web.reactive.BindingContext in project spring-framework by spring-projects.
the class RequestAttributeMethodArgumentResolverTests method resolve.
@Test
public void resolve() throws Exception {
MethodParameter param = initMethodParameter(0);
Mono<Object> mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
StepVerifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify();
Foo foo = new Foo();
this.exchange.getAttributes().put("foo", foo);
mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
assertSame(foo, mono.block());
}
use of org.springframework.web.reactive.BindingContext in project spring-framework by spring-projects.
the class RequestBodyArgumentResolverTests method resolveValueWithEmptyBody.
@SuppressWarnings("unchecked")
private <T> T resolveValueWithEmptyBody(MethodParameter param) {
ServerWebExchange exchange = MockServerHttpRequest.post("/path").build().toExchange();
Mono<Object> result = this.resolver.resolveArgument(param, new BindingContext(), exchange);
Object value = result.block(Duration.ofSeconds(5));
if (value != null) {
assertTrue("Unexpected parameter type: " + value, param.getParameterType().isAssignableFrom(value.getClass()));
}
//no inspection unchecked
return (T) value;
}
use of org.springframework.web.reactive.BindingContext in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method setup.
@Before
public void setup() throws Exception {
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
initializer.setValidator(new TestBeanValidator());
this.bindingContext = new BindingContext(initializer);
}
use of org.springframework.web.reactive.BindingContext in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method invoke.
private Mono<HandlerResult> invoke(Object handler, Method method, HandlerMethodArgumentResolver... resolver) {
InvocableHandlerMethod hm = new InvocableHandlerMethod(handler, method);
hm.setArgumentResolvers(Arrays.asList(resolver));
return hm.invoke(this.exchange, new BindingContext());
}
use of org.springframework.web.reactive.BindingContext in project spring-framework by spring-projects.
the class ServerWebExchangeArgumentResolverTests method testResolveArgument.
private void testResolveArgument(MethodParameter parameter, Object expected) {
Mono<Object> mono = this.resolver.resolveArgument(parameter, new BindingContext(), this.exchange);
assertSame(expected, mono.block());
}
Aggregations