@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();
}
MustacheViewResolverTests.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:https-github.com-g0t4-jenkins2-course-spring-boot
作者:
评论列表
文章目录