我有一段Java代碼,將一個目錄的內容壓縮成一個zip文件。JUnit爲一個目錄拉鍊
該方法的簽名如下:
/**
* Zips the contents of the directory into the zip file.
* @param directory the directory to zip
* @param zipFilename the file name to zip into
*/
public static void doZIP(String directory, String zipFileName)
{
//do the zipping
}
現在我必須寫一個JUnit測試情況下,用於上述方法。我應該測試什麼,以及如何?
注意:我不在尋找如何編寫JUnit測試用例的答案。
在此先感謝。
我可以在Java中完成整個目錄的MD5嗎?它將包含單個文件以及其中的其他子目錄。 – user801138
對創建的zip文件執行校驗和,並將其與預期的zip進行比較可能是實現它的方法。 – luketorjussen