// Path: core/src/main/java/de/otto/jlineup/file/FileUtils.java
// public static void clearDirectory(String path) throws IOException {
//     Path directory = Paths.get(path);
//     try(DirectoryStream<Path> paths = Files.newDirectoryStream(directory);) {
//         paths.forEach(file -> {
//             try {
//                 if (Files.isDirectory(file)) {
//                     clearDirectory(file.toAbsolutePath().toString());
//                 }
// 
//                 Files.delete(file);
//             } catch (IOException e) {
//                 throw new UncheckedIOException(e);
//             }
//         });
//     }
// }
// 
// Path: core/src/main/java/de/otto/jlineup/file/FileUtils.java
// public static void deleteDirectory(Path path) throws IOException {
//     clearDirectory(path.toString());
//     Files.deleteIfExists(path);
// }


import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static de.otto.jlineup.file.FileUtils.clearDirectory;
import static de.otto.jlineup.file.FileUtils.deleteDirectory;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package de.otto.jlineup.file;




public class FileUtilsTest {


    @Test
    public void shouldClearDirectory() throws IOException {
        //given
        final Path dirToClear = Files.createTempDirectory("jlineup-fileutils-test");
        Files.createFile(dirToClear.resolve(Paths.get("test1")));
        Files.createFile(dirToClear.resolve(Paths.get("test2")));
        Files.createFile(dirToClear.resolve(Paths.get("test3")));

        //when
// Path: core/src/main/java/de/otto/jlineup/file/FileUtils.java
// public static void clearDirectory(String path) throws IOException {
//     Path directory = Paths.get(path);
//     try(DirectoryStream<Path> paths = Files.newDirectoryStream(directory);) {
//         paths.forEach(file -> {
//             try {
//                 if (Files.isDirectory(file)) {
//                     clearDirectory(file.toAbsolutePath().toString());
//                 }
// 
//                 Files.delete(file);
//             } catch (IOException e) {
//                 throw new UncheckedIOException(e);
//             }
//         });
//     }
// }
// 
// Path: core/src/main/java/de/otto/jlineup/file/FileUtils.java
// public static void deleteDirectory(Path path) throws IOException {
//     clearDirectory(path.toString());
//     Files.deleteIfExists(path);
// }


// Path: core/src/test/java/de/otto/jlineup/file/FileUtilsTest.java
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static de.otto.jlineup.file.FileUtils.clearDirectory;
import static de.otto.jlineup.file.FileUtils.deleteDirectory;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

package de.otto.jlineup.file;




public class FileUtilsTest {


    @Test
    public void shouldClearDirectory() throws IOException {
        //given
        final Path dirToClear = Files.createTempDirectory("jlineup-fileutils-test");
        Files.createFile(dirToClear.resolve(Paths.get("test1")));
        Files.createFile(dirToClear.resolve(Paths.get("test2")));
        Files.createFile(dirToClear.resolve(Paths.get("test3")));

        //when
        clearDirectory(dirToClear.toString());