Skip to content

Commit

Permalink
Delete directory recursively with a helper
Browse files Browse the repository at this point in the history
Lean on Guava.
  • Loading branch information
findepi authored and nineinchnick committed Feb 5, 2024
1 parent e6f4892 commit 6260719
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/test/java/pl/net/was/trino/git/TestGitClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.Date;
import java.util.Set;
import java.util.TimeZone;

import static com.google.common.io.MoreFiles.deleteRecursively;
import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE;
import static org.assertj.core.api.Assertions.assertThat;

public class TestGitClient
Expand Down Expand Up @@ -64,10 +63,7 @@ public static void setupRepo(URI uri)
return;
}
if (localPath.exists()) {
Files.walk(localPath.toPath())
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
deleteRecursively(localPath.toPath(), ALLOW_INSECURE);
}

Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
Expand Down

0 comments on commit 6260719

Please sign in to comment.