private ServerWebExchange generateServerWebExchange(final boolean haveResponse) {
        ResponseEntity mockResponse = mock(ResponseEntity.class);
        when(mockResponse.getHeaders()).thenReturn(mock(HttpHeaders.class));
        when(mockResponse.getBody()).thenReturn(Mono.empty());

        ServerWebExchange exchange = MockServerWebExchange
                .from(MockServerHttpRequest.get("/test").build());

        exchange.getAttributes().put(Constants.CONTEXT, mock(ShenyuContext.class));
        exchange.getAttributes().put(Constants.HTTP_URI, "/test");
        if (haveResponse) {
            exchange.getAttributes().put(Constants.CLIENT_RESPONSE_ATTR, mockResponse);
        }
        return exchange;
    }
The test case for {@link WebClientMessageWriter}.
shenyu-plugin/shenyu-plugin-response/src/test/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriterTest.java