diff --git a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java index 34a2a6afa..586ca0ad1 100644 --- a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java @@ -30,8 +30,8 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { /** Mock of a settings instance. */ private static NewSetting settings; - /** Collection of SQL statements to execute for initialization of a test. */ - private static String[] sqlInitialize; + /** SQL statement to execute before running a test. */ + private static String sqlInitialize; /** Connection to the H2 test database. */ private HikariDataSource hikariSource; @@ -56,7 +56,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { ConsoleLoggerTestInitializer.setupLogger(); Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql"); - sqlInitialize = new String(Files.readAllBytes(sqlInitFile)).split(";\\n"); + sqlInitialize = new String(Files.readAllBytes(sqlInitFile)); } @Before @@ -73,9 +73,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { try (Statement st = connection.createStatement()) { st.execute("DROP TABLE IF EXISTS authme"); - for (String statement : sqlInitialize) { - st.execute(statement); - } + st.execute(sqlInitialize); } hikariSource = ds; } diff --git a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java index 5c08b4790..715d2ce9b 100644 --- a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java @@ -57,7 +57,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest { Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql"); // Note ljacqu 20160221: It appears that we can only run one statement per Statement.execute() so we split // the SQL file by ";\n" as to get the individual statements - sqlInitialize = new String(Files.readAllBytes(sqlInitFile)).split(";\\n"); + sqlInitialize = new String(Files.readAllBytes(sqlInitFile)).split(";(\\r?)\\n"); } @Before