@Test
public void testSnappyWriterInterceptor() throws IOException {
SnappyWriterInterceptor writerInterceptor = new SnappyWriterInterceptor();
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
WriterInterceptorContext mockInterceptorContext = Mockito.mock(WriterInterceptorContext.class);
Mockito.when(mockInterceptorContext.getHeaders()).thenReturn(headers);
Mockito.when(mockInterceptorContext.getOutputStream()).thenReturn(new ByteArrayOutputStream());
Mockito.doNothing().when(mockInterceptorContext).setOutputStream(Mockito.any(OutputStream.class));
// call aroundWriteTo on mock
writerInterceptor.aroundWriteTo(mockInterceptorContext);
// verify that setOutputStream method was called once with argument which is an instance of SnappyFramedOutputStream
Mockito.verify(mockInterceptorContext, Mockito.times(1))
.setOutputStream(Mockito.any(SnappyFramedOutputStream.class));
}
TestSnappyWriterInterceptor.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:datacollector
作者:
评论列表
文章目录