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");
}
use of org.springframework.web.reactive.HandlerResult in project spring-framework by spring-projects.
the class InvocableHandlerMethodTests method voidMethodWithExchangeArg.
@Test
public void voidMethodWithExchangeArg() {
this.resolvers.add(stubResolver(this.exchange));
Method method = ResolvableMethod.on(TestController.class).mockCall(c -> c.exchange(exchange)).method();
HandlerResult result = invokeForResult(new TestController(), method);
assertThat(result).as("Expected no result (i.e. fully handled)").isNull();
assertThat(this.exchange.getResponse().getHeaders().getFirst("foo")).isEqualTo("bar");
}
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");
}
Aggregations