Suppose I have this simple webfilter that just writes a reactor context
WebFilter filter = (serverWebExchange, webFilterChain) ->
webFilterChain
.filter(serverWebExchange)
.contextWrite(Context.of("my-key", true));
I'd imagine the test will look something like this:
StepVerifier.create(filter.filter(serverWebExchange, webFilterChain)
.expectAccessibleContext()
.hasKey("my-key")
.then()
.verifyComplete();
But I'm not sure how to mock the webFilterChain to make sure the Context is written.
Mockito.when(webFilterChain.filter(any()).thenReturn(???)
Any ideas?