how can I write a JUnit test that checks if FileInputStream is closed?
Consider the following code:
import java.io.FileInputStream; class FileInputStreamDemo { public static void main(String args[]) throws Exception { FileInputStream fis = new FileInputStream(args[0]);
I would like to write a test as follows:
@Test public void test() { FileInputStreamDemo.main("file.txt");
Although this code example does not make much sense, I would now like to write how to write a JUnit test that checks if FIS is closed. (If possible: without reference to the original FIS object)
source share