This commit is contained in:
Madhura Bhave 2018-07-18 10:29:43 -07:00
parent 681717d07a
commit 66156cc24f
2 changed files with 3 additions and 2 deletions

View File

@ -88,7 +88,8 @@ public abstract class ApplicationContextServerWebExchangeMatcher<C>
@SuppressWarnings("unchecked")
private Supplier<C> createContext(ServerWebExchange exchange) {
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)) {
return () -> (C) context;
}

View File

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