// 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.junit.Test;
import org.junit.experimental.categories.Category;
import org.sharedmq.test.CommonTests;
import org.sharedmq.test.TestFolder;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.sharedmq.test.TestUtils.assertThrows;
                    () -> ConfigurationFile.open(file));

            assertTrue(file.delete());

            try (ConfigurationFile configFile = ConfigurationFile.create(file, new Configuration(123, 456))) {
                Configuration config = configFile.getConfiguration();
                assertEquals(config.getVisibilityTimeout(), 123);
                assertEquals(config.getRetentionPeriod(), 456);
            }

            // creating a config file with same parameters
            try (ConfigurationFile configFile = ConfigurationFile.create(file, new Configuration(123, 456))) {
                Configuration config = configFile.getConfiguration();
                assertEquals(config.getVisibilityTimeout(), 123);
                assertEquals(config.getRetentionPeriod(), 456);
            }

            // creating a config file with different parameter (visibilityTimeout)
            assertThrows(
                    IOException.class,
                    "exists and have different parameters",
                    () -> ConfigurationFile.create(file, new Configuration(111, 456)));

            // creating a config file with different parameter (retentionPeriod)
            assertThrows(
                    IOException.class,
                    "exists and have different parameters",
                    () -> ConfigurationFile.create(file, new Configuration(123, 444)));

            // obtaining parameters from the configuration file
// 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/internals/ConfigurationFileTest.java
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.sharedmq.test.CommonTests;
import org.sharedmq.test.TestFolder;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.sharedmq.test.TestUtils.assertThrows;

                    () -> ConfigurationFile.open(file));

            assertTrue(file.delete());

            try (ConfigurationFile configFile = ConfigurationFile.create(file, new Configuration(123, 456))) {
                Configuration config = configFile.getConfiguration();
                assertEquals(config.getVisibilityTimeout(), 123);
                assertEquals(config.getRetentionPeriod(), 456);
            }

            // creating a config file with same parameters
            try (ConfigurationFile configFile = ConfigurationFile.create(file, new Configuration(123, 456))) {
                Configuration config = configFile.getConfiguration();
                assertEquals(config.getVisibilityTimeout(), 123);
                assertEquals(config.getRetentionPeriod(), 456);
            }

            // creating a config file with different parameter (visibilityTimeout)
            assertThrows(
                    IOException.class,
                    "exists and have different parameters",
                    () -> ConfigurationFile.create(file, new Configuration(111, 456)));

            // creating a config file with different parameter (retentionPeriod)
            assertThrows(
                    IOException.class,
                    "exists and have different parameters",
                    () -> ConfigurationFile.create(file, new Configuration(123, 444)));

            // obtaining parameters from the configuration file
            try (ConfigurationFile configFile = ConfigurationFile.open(file)) {