// Path: src/test/java/org/sharedmq/test/CommonTests.java
// public interface CommonTests {
// }
// 
// Path: src/test/java/org/sharedmq/test/TestFolder.java
// public class TestFolder implements Closeable {
// 
//     private final File root;
// 
//     /**
//      * Creates an new folder in the default temporary-file directory.
//      *
//      * @param prefix The prefix for the new folder name.
//      * @param suffix The suffix for the new folder name.
//      * @throws IOException If folder creation fails.
//      */
//     public TestFolder(String prefix, String suffix) throws IOException {
//         root = File.createTempFile(prefix, suffix);
//         if (!root.delete() || !root.mkdir()) {
//             throw new IOException("Failed to prepare test folder.");
//         }
//     }
// 
//     /**
//      * Returns a {@link File} object matching this folder location.
//      */
//     public File getRoot() {
//         return root;
//     }
// 
//     /**
//      * Returns an {@link File} instance for the file with the given name in this test folder.
//      *
//      * @param filename The name of the faile.
//      */
//     public File getFile(String filename) {
//         return new File(root, filename);
//     }
// 
//     /**
//      * Deletes this test folder and all its content.
//      *
//      * @throws IOException
//      */
//     @Override
//     public void close() throws IOException {
// 
//         // A mapped byte buffer and the file mapping that it represents
//         // remain valid until the buffer itself is garbage-collected.
//         System.gc();
// 
//         IOUtils.deleteTree(root);
//     }
// }
// 
// Path: src/test/java/org/sharedmq/test/TestUtils.java
// public static <T extends Exception> void assertThrows(
//         Class<T> errorClass,
//         String expectedMessagePart,
//         TestedAction action
// ) {
//     try {
//         action.invoke();
//         fail("an exception was expected");
//     } catch (AssertionError e) {
//         throw e;
//     } catch (Throwable e) {
//         if (!errorClass.isInstance(e)) {
//             throw new AssertionError("Expected '" + errorClass.getName() + "'" +
//                     ", but encountered '" + e.getClass().getName() + "'."
//                     , e);
//         }
//         if (expectedMessagePart != null) {
//             String message = e.getMessage();
//             if (message == null || !message.contains(expectedMessagePart)) {
//                 throw new AssertionError("Expected an exception" +
//                         " with the message '..." + expectedMessagePart + "...'" +
//                         ", but encountered '" + e.getMessage() + "'."
//                         , e);
//             }
//         }
//     }
// }


import org.sharedmq.test.CommonTests;
import org.sharedmq.test.TestFolder;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.*;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import static org.sharedmq.test.TestUtils.assertThrows;
import static org.junit.Assert.*;

            File subfolder = new File(folder, "subfolder");
            File fileInSubfolder = new File(subfolder, "test.dat");

            assertTrue(folder.mkdir());
            assertTrue(subfolder.mkdir());
            assertTrue(fileInSubfolder.createNewFile());

            IOUtils.deleteTree(folder);

            assertFalse(folder.exists());
            assertFalse(subfolder.exists());
            assertFalse(fileInSubfolder.exists());
        }
    }

    @Test
    public void testClose() throws IOException, InterruptedException {

        IOUtils.close();
        IOUtils.close((Closeable) null);
        IOUtils.close((Closeable) null, (Closeable) null);

        IOUtils.close(Arrays.asList());
        IOUtils.close(Arrays.asList((Closeable) null));
        IOUtils.close(Arrays.asList((Closeable) null, (Closeable) null));

        try {
            IOUtils.close(
                    () -> {
// Path: src/test/java/org/sharedmq/test/CommonTests.java
// public interface CommonTests {
// }
// 
// Path: src/test/java/org/sharedmq/test/TestFolder.java
// public class TestFolder implements Closeable {
// 
//     private final File root;
// 
//     /**
//      * Creates an new folder in the default temporary-file directory.
//      *
//      * @param prefix The prefix for the new folder name.
//      * @param suffix The suffix for the new folder name.
//      * @throws IOException If folder creation fails.
//      */
//     public TestFolder(String prefix, String suffix) throws IOException {
//         root = File.createTempFile(prefix, suffix);
//         if (!root.delete() || !root.mkdir()) {
//             throw new IOException("Failed to prepare test folder.");
//         }
//     }
// 
//     /**
//      * Returns a {@link File} object matching this folder location.
//      */
//     public File getRoot() {
//         return root;
//     }
// 
//     /**
//      * Returns an {@link File} instance for the file with the given name in this test folder.
//      *
//      * @param filename The name of the faile.
//      */
//     public File getFile(String filename) {
//         return new File(root, filename);
//     }
// 
//     /**
//      * Deletes this test folder and all its content.
//      *
//      * @throws IOException
//      */
//     @Override
//     public void close() throws IOException {
// 
//         // A mapped byte buffer and the file mapping that it represents
//         // remain valid until the buffer itself is garbage-collected.
//         System.gc();
// 
//         IOUtils.deleteTree(root);
//     }
// }
// 
// Path: src/test/java/org/sharedmq/test/TestUtils.java
// public static <T extends Exception> void assertThrows(
//         Class<T> errorClass,
//         String expectedMessagePart,
//         TestedAction action
// ) {
//     try {
//         action.invoke();
//         fail("an exception was expected");
//     } catch (AssertionError e) {
//         throw e;
//     } catch (Throwable e) {
//         if (!errorClass.isInstance(e)) {
//             throw new AssertionError("Expected '" + errorClass.getName() + "'" +
//                     ", but encountered '" + e.getClass().getName() + "'."
//                     , e);
//         }
//         if (expectedMessagePart != null) {
//             String message = e.getMessage();
//             if (message == null || !message.contains(expectedMessagePart)) {
//                 throw new AssertionError("Expected an exception" +
//                         " with the message '..." + expectedMessagePart + "...'" +
//                         ", but encountered '" + e.getMessage() + "'."
//                         , e);
//             }
//         }
//     }
// }


// Path: src/test/java/org/sharedmq/util/IOUtilsTest.java
import org.sharedmq.test.CommonTests;
import org.sharedmq.test.TestFolder;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.*;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import static org.sharedmq.test.TestUtils.assertThrows;
import static org.junit.Assert.*;


            File subfolder = new File(folder, "subfolder");
            File fileInSubfolder = new File(subfolder, "test.dat");

            assertTrue(folder.mkdir());
            assertTrue(subfolder.mkdir());
            assertTrue(fileInSubfolder.createNewFile());

            IOUtils.deleteTree(folder);

            assertFalse(folder.exists());
            assertFalse(subfolder.exists());
            assertFalse(fileInSubfolder.exists());
        }
    }

    @Test
    public void testClose() throws IOException, InterruptedException {

        IOUtils.close();
        IOUtils.close((Closeable) null);
        IOUtils.close((Closeable) null, (Closeable) null);

        IOUtils.close(Arrays.asList());
        IOUtils.close(Arrays.asList((Closeable) null));
        IOUtils.close(Arrays.asList((Closeable) null, (Closeable) null));

        try {
            IOUtils.close(
                    () -> {
                        throw new IOException("Exception #1");