MustacheViewResolverTests.java 文件源码

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

项目:spring-boot-concourse 作者:
@Test
public void templateResourceInputStreamIsClosed() throws Exception {
    final Resource resource = mock(Resource.class);
    given(resource.exists()).willReturn(true);
    InputStream inputStream = new ByteArrayInputStream(new byte[0]);
    InputStream spyInputStream = spy(inputStream);
    given(resource.getInputStream()).willReturn(spyInputStream);
    this.resolver = new MustacheViewResolver();
    this.resolver.setApplicationContext(new StaticWebApplicationContext() {

        @Override
        public Resource getResource(String location) {
            return resource;
        }

    });
    this.resolver.loadView("foo", null);
    verify(spyInputStream).close();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号