Merge branch '2.0.x'

pull/13818/head
Madhura Bhave 6 years ago
commit 6333edbe16

@ -88,7 +88,8 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C>
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private Supplier<C> createContext(ServerWebExchange exchange) { private Supplier<C> createContext(ServerWebExchange exchange) {
ApplicationContext context = exchange.getApplicationContext(); ApplicationContext context = exchange.getApplicationContext();
Assert.state(context != null, "No ApplicationContext found."); Assert.state(context != null,
"No ApplicationContext found on ServerWebExchange.");
if (this.contextClass.isInstance(context)) { if (this.contextClass.isInstance(context)) {
return () -> (C) context; return () -> (C) context;
} }

@ -91,7 +91,7 @@ public class ApplicationContextServerWebExchangeMatcherTests {
MockServerWebExchange exchange = MockServerWebExchange MockServerWebExchange exchange = MockServerWebExchange
.from(MockServerHttpRequest.get("/path").build()); .from(MockServerHttpRequest.get("/path").build());
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("No ApplicationContext found."); this.thrown.expectMessage("No ApplicationContext found on ServerWebExchange.");
new TestApplicationContextServerWebExchangeMatcher<>(ExistingBean.class) new TestApplicationContextServerWebExchangeMatcher<>(ExistingBean.class)
.callMatchesAndReturnProvidedContext(exchange); .callMatchesAndReturnProvidedContext(exchange);
} }

Loading…
Cancel
Save