我目前正在尝试使用 power mockito 测试打印到 servlet 输出流的内容,但我找不到任何方法。
这是我到目前为止所拥有的
Routing routingMock = PowerMockito.mock( Routing.class );
HttpServletRequest httpRequestMock = PowerMockito.mock( HttpServletRequest.class );
HttpServletResponse httpServletResponseMock = PowerMockito.mock( HttpServletResponse.class );
PowerMockito.when( httpRequestMock.getPathInfo() ).thenReturn( "/Users" );
ServletOutputStream outputStreamMock = PowerMockito.mock( ServletOutputStream.class );
PowerMockito.when( httpServletResponseMock.getOutputStream() ).thenReturn( outputStream );
routingMock.doGet( httpRequestMock, httpServletResponseMock );
谁能帮我弄清楚如何访问写入 outputStreamMock 的数据?
谢谢