use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class HandlerFunctionAdapter method handle.
@Override
public Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler) {
HandlerFunction<?> handlerFunction = (HandlerFunction<?>) handler;
ServerRequest request = exchange.getRequiredAttribute(RouterFunctions.REQUEST_ATTRIBUTE);
return handlerFunction.handle(request).map(response -> new HandlerResult(handlerFunction, response, HANDLER_FUNCTION_RETURN_TYPE));
}
use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method invocationTargetException.
@Test
public void invocationTargetException() {
Method method = ResolvableMethod.on(TestController.class).mockCall(TestController::exceptionMethod).method();
Mono<HandlerResult> mono = invoke(new TestController(), method);
assertThatIllegalStateException().isThrownBy(mono::block).withMessage("boo");
}
use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method resolveArg.
@Test
public void resolveArg() {
this.resolvers.add(stubResolver("value1"));
Method method = ResolvableMethod.on(TestController.class).mockCall(o -> o.singleArg(null)).method();
Mono<HandlerResult> mono = invoke(new TestController(), method);
assertHandlerResultValue(mono, "success:value1");
}
use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method resolveProvidedArgFirst.
@Test
public void resolveProvidedArgFirst() {
this.resolvers.add(stubResolver("value1"));
Method method = ResolvableMethod.on(TestController.class).mockCall(o -> o.singleArg(null)).method();
Mono<HandlerResult> mono = invoke(new TestController(), method, "value2");
assertHandlerResultValue(mono, "success:value2");
}
use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method resolveNoArgValue.
@Test
public void resolveNoArgValue() {
this.resolvers.add(stubResolver(Mono.empty()));
Method method = ResolvableMethod.on(TestController.class).mockCall(o -> o.singleArg(null)).method();
Mono<HandlerResult> mono = invoke(new TestController(), method);
assertHandlerResultValue(mono, "success:null");
}
Aggregations