JUnit test case to check if file was created

China☆狼群 提交于 2020-01-03 09:08:12

问题


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:


File file = new File("c:/pathOfTheCreatedFile");
assertTrue(file.exists());
// TODO: read the file. Check that it contains what it's supposed to contain


来源:https://stackoverflow.com/questions/18397166/junit-test-case-to-check-if-file-was-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!