ConditionalBase64ReadInterceptorTest.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:jrestless 作者:
@Test
public void testWrapsInputStreamAlways() throws WebApplicationException, IOException {
    ReaderInterceptorContext context = mock(ReaderInterceptorContext.class);
    InputStream is = mock(InputStream.class);
    when(context.getInputStream()).thenReturn(is);

    alwaysBase64ReadInterceptor.aroundReadFrom(context);

    verifyZeroInteractions(is);

    ArgumentCaptor<InputStream> updatedIsCapture = ArgumentCaptor.forClass(InputStream.class);
    verify(context).setInputStream(updatedIsCapture.capture());
    verify(context).proceed();
    verify(context).getInputStream();
    verifyNoMoreInteractions(context);

    InputStream updatedIs = updatedIsCapture.getValue();

    verify(alwaysBase64ReadInterceptor).isBase64(context);

    // just make sure we have some wrapper
    assertNotSame(is, updatedIs);
    updatedIs.close();
    verify(is).close();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号