【问题标题】:JUnit test case to check if file was createdJUnit 测试用例检查文件是否已创建
【发布时间】:2013-08-26 04:05:54
【问题描述】:

我创建了一个简单的程序,它将通过缓冲写入器创建 dat 文件并将一些数据写入该文件,现在请告知我可以拥有哪些 junit 测试用例,通过它我可以检查文件是否已创建c:驱动,我用的是junit 3,请指教。

【问题讨论】:

  • 你试过了吗?也许检查您是否可以读取该文件。

标签: unit-testing testing junit3


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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多