Skip to content

Commit a13df27

Browse files
devonfw#1024: added extract test to FileAccess tests
1 parent 1704672 commit a13df27

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

cli/src/test/java/com/devonfw/tools/ide/io/FileAccessImplTest.java

+25
Original file line numberDiff line numberDiff line change
@@ -579,4 +579,29 @@ public void testGeneratePermissionString() {
579579

580580
}
581581

582+
/**
583+
* Tests if extract was called with disabled extract param, the archive will be moved.
584+
*
585+
* @param tempDir temporary directory to use.
586+
*/
587+
@Test
588+
public void testDisabledExtractMovesArchive(@TempDir Path tempDir) {
589+
// arrange
590+
IdeContext context = IdeTestContextMock.get();
591+
FileAccessImpl fileAccess = new FileAccessImpl(context);
592+
Path downloadArchive = tempDir.resolve("downloaded.zip");
593+
fileAccess.touch(downloadArchive);
594+
Path installationPath = tempDir.resolve("installation");
595+
Path targetPath = installationPath.resolve("downloaded.zip");
596+
boolean extract = false;
597+
// act
598+
fileAccess.extract(downloadArchive, installationPath, this::postExtract, extract);
599+
// assert
600+
assertThat(targetPath).exists();
601+
}
602+
603+
private void postExtract(Path path) {
604+
}
605+
606+
582607
}

0 commit comments

Comments
 (0)