JUnit test case to check if file was created

2019-06-17 10:26发布

I have created a simple program that wil create the dat file through buffered writer and will write some data into that file , now please advise what junit test cases I can have through which I can check whether the file is created or not in c: drive , I am using junit 3 , please advise.

1条回答
我只想做你的唯一
2楼-- · 2019-06-17 11:04
File file = new File("c:/pathOfTheCreatedFile");
assertTrue(file.exists());
// TODO: read the file. Check that it contains what it's supposed to contain
查看更多
登录 后发表回答