I want to write a unit test to test creating .zip file from two .doc files. BU I take an error: Error creating zip file: java.io.FileNotFoundException: D:\file1.txt (The system cannot find the file specified)
My code is here:
@Test
public void testIsZipped() {
    String actualValue1 = "D:/file1.txt";
    String actualValue2 = "D:/file2.txt";
    String zipFile = "D:/file.zip";
    String[] srcFiles = { actualValue1, actualValue2 };
    try {
        // create byte buffer
        byte[] buffer = new byte[1024];
        FileOutputStream fos = new FileOutputStream(zipFile);
        zos = new ZipOutputStream(fos);
        for (int i = 0; i < srcFiles.length; i++) {
            File srcFile = new File(srcFiles[i]);
            FileInputStream fis = new FileInputStream(srcFile);
            // begin writing a new ZIP entry, positions the stream to the
            // start of the entry data
            zos.putNextEntry(new ZipEntry(srcFile.getName()));
            int length;
            while ((length = fis.read(buffer)) > 0) {
                zos.write(buffer, 0, length);
            }
            zos.closeEntry();
            // close the InputStream
            fis.close();
        }
        // close the ZipOutputStream
        zos.close();
    }
    catch (IOException ioe) {
        System.out.println("Error creating zip file: " + ioe);
    }
    String result = zos.toString();
    assertEquals("D:/file.zip", result);
}
Can I get name of zip file from zos to test, How to understand to pass the test? Can anybody help me to solve this error? Thank you.
 
     
    