Skip to content

Commit

Permalink
add tests for deleting folders
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeLtDave committed May 15, 2024
1 parent 48a64d2 commit 555e56c
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.eclipse.core.tests.filesystem.zip.ZipFileSystemTestUtil.ensureExists;
import static org.eclipse.core.tests.filesystem.zip.ZipFileSystemTestUtil.getMonitor;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import org.eclipse.core.resources.IFile;
Expand Down Expand Up @@ -61,6 +62,36 @@ public void testDeleteFileInsideOfZipFile(String zipFileName) throws CoreExcepti
ensureDoesNotExist(textFile);
}

@ParameterizedTest
@MethodSource("org.eclipse.core.tests.filesystem.zip.ZipFileSystemTestUtil#zipFileNames")
public void testDeleteEmptyFolder(String zipFileName) throws CoreException, IOException {
IFolder openedZipFile = ZipFileSystemTestSetup.firstProject.getFolder(zipFileName);
IFolder folder = openedZipFile.getFolder("FolderToDelete");
ensureDoesNotExist(folder);
folder.create(true, true, getMonitor());
ensureExists(folder);
folder.delete(true, getMonitor());
ensureDoesNotExist(folder);
}


@ParameterizedTest
@MethodSource("org.eclipse.core.tests.filesystem.zip.ZipFileSystemTestUtil#zipFileNames")
public void testDeleteFolderWithChildren(String zipFileName) throws CoreException, IOException {
IFolder openedZipFile = ZipFileSystemTestSetup.firstProject.getFolder(zipFileName);
IFolder folder = openedZipFile.getFolder("FolderToDelete");
ensureDoesNotExist(folder);
folder.create(true, true, getMonitor());
ensureExists(folder);
IFile textFile = folder.getFile(ZipFileSystemTestSetup.TEXT_FILE_NAME);
textFile.create(new ByteArrayInputStream("Hello World!".getBytes()), true, getMonitor());
ensureExists(textFile);
folder.delete(true, getMonitor());
ensureDoesNotExist(folder);
ensureDoesNotExist(textFile);
}


@ParameterizedTest
@MethodSource("org.eclipse.core.tests.filesystem.zip.ZipFileSystemTestUtil#zipFileNames")
public void testDeleteNestedZipFileParent(String zipFileName)
Expand Down

0 comments on commit 555e56c

Please sign in to comment.