我有一个InputStream捕获的单元测试。例如:EasyMock:我应该关闭捕获的InputStream吗?
Capture<InputStream> capturedArgument = new Capture<InputStream>();
// some expectations and the tested method execution here
InputStream actualStream = capturedArgument.getValue();
// some assertions here
在测试对象中关闭实际流(在测试中捕获)。 我应该在单元测试中断言后手动关闭actualStream吗?或者在实际的流量关闭后它也会被关闭?
谢谢。
谢谢你的回答!很明显。 这很奇怪,但不止一次关闭流之后没有任何异常。所以我不能用这种方法检查它是否已经关闭。 – yaskovdev