@Test
public void onDataInRequestShouldReturnThisData() throws Exception {
// GIVEN
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("hello".getBytes());
when(request.getInputStream()).thenReturn(new ServletInputStream() {
@Override
public int read() throws IOException {
return byteArrayInputStream.read();
}
});
// WHEN
BufferedRequestWrapper sut = new BufferedRequestWrapper(request);
ServletInputStream inputStream = sut.getInputStream();
// THEN
assertThat(inputStream).hasSameContentAs(new ByteArrayInputStream("hello".getBytes()));
}
BufferedRequestWrapperTest.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:crnk-framework
作者:
评论列表
文章目录