diff --git a/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java b/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java index 25e95f83f..722089925 100644 --- a/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java +++ b/src/test/java/fr/xephi/authme/AuthMeInitializationTest.java @@ -72,7 +72,7 @@ public class AuthMeInitializationTest { public void initAuthMe() throws IOException { dataFolder = temporaryFolder.newFolder(); settingsFile = new File(dataFolder, "config.yml"); - Files.copy(TestHelper.getJarFile("/initialization/config.test.yml"), settingsFile); + Files.copy(TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "config.test.yml"), settingsFile); // Mock / wire various Bukkit components given(server.getLogger()).willReturn(mock(Logger.class)); diff --git a/src/test/java/fr/xephi/authme/TestHelper.java b/src/test/java/fr/xephi/authme/TestHelper.java index bef656219..58f3355cb 100644 --- a/src/test/java/fr/xephi/authme/TestHelper.java +++ b/src/test/java/fr/xephi/authme/TestHelper.java @@ -28,6 +28,8 @@ import static org.mockito.Mockito.verify; */ public final class TestHelper { + public static final String PROJECT_ROOT = "/fr/xephi/authme/"; + private TestHelper() { } diff --git a/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java b/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java index 0183c613e..615ef915c 100644 --- a/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java +++ b/src/test/java/fr/xephi/authme/converter/CrazyLoginConverterTest.java @@ -45,7 +45,7 @@ public class CrazyLoginConverterTest { private NewSetting settings; @DataFolder - private File dataFolder = TestHelper.getJarFile("/converter/"); + private File dataFolder = TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "converter/"); @BeforeClass public static void initializeLogger() { diff --git a/src/test/java/fr/xephi/authme/converter/ForceFlatToSqliteTest.java b/src/test/java/fr/xephi/authme/converter/ForceFlatToSqliteTest.java index 6f6082cee..903c58ff3 100644 --- a/src/test/java/fr/xephi/authme/converter/ForceFlatToSqliteTest.java +++ b/src/test/java/fr/xephi/authme/converter/ForceFlatToSqliteTest.java @@ -41,7 +41,7 @@ public class ForceFlatToSqliteTest { @Before public void copyFile() throws IOException { - File source = TestHelper.getJarFile("/datasource-integration/flatfile-test.txt"); + File source = TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "datasource/flatfile-test.txt"); File destination = temporaryFolder.newFile(); Files.copy(source, destination); flatFile = new FlatFile(destination); diff --git a/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java index 0c0ab8e1e..853cbd78c 100644 --- a/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java @@ -35,7 +35,7 @@ public class FlatFileIntegrationTest { @Before public void copyFileToTemporaryFolder() throws IOException { - File originalFile = TestHelper.getJarFile("/datasource-integration/flatfile-test.txt"); + File originalFile = TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "datasource/flatfile-test.txt"); File copy = temporaryFolder.newFile(); Files.copy(originalFile, copy); dataSource = new FlatFile(copy); diff --git a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java index ec90dab09..397693069 100644 --- a/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/MySqlIntegrationTest.java @@ -54,7 +54,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest { set(DatabaseSettings.MYSQL_TABLE, "authme"); TestHelper.setupLogger(); - Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql"); + Path sqlInitFile = TestHelper.getJarPath(TestHelper.PROJECT_ROOT + "datasource/sql-initialize.sql"); sqlInitialize = new String(Files.readAllBytes(sqlInitFile)); } diff --git a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java index 3cfe9eb26..a654fca66 100644 --- a/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/datasource/SQLiteIntegrationTest.java @@ -53,7 +53,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest { set(DatabaseSettings.MYSQL_TABLE, "authme"); TestHelper.setupLogger(); - Path sqlInitFile = TestHelper.getJarPath("/datasource-integration/sql-initialize.sql"); + Path sqlInitFile = TestHelper.getJarPath(TestHelper.PROJECT_ROOT + "datasource/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(";(\\r?)\\n"); diff --git a/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java b/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java index 61eea6a97..cea523c48 100644 --- a/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/output/MessagesIntegrationTest.java @@ -33,8 +33,8 @@ import static org.mockito.Mockito.verify; */ public class MessagesIntegrationTest { - private static final String YML_TEST_FILE = "/messages_test.yml"; - private static final String YML_DEFAULT_TEST_FILE = "/messages_default.yml"; + private static final String YML_TEST_FILE = TestHelper.PROJECT_ROOT + "output/messages_test.yml"; + private static final String YML_DEFAULT_TEST_FILE = TestHelper.PROJECT_ROOT + "output/messages_default.yml"; private Messages messages; @BeforeClass @@ -255,7 +255,8 @@ public class MessagesIntegrationTest { // assumption: message comes back as defined in messages_test.yml assumeThat(messages.retrieveSingle(key), equalTo("§cWrong password!")); NewSetting settings = mock(NewSetting.class); - given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile("/messages_test2.yml")); + given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile( + TestHelper.PROJECT_ROOT + "output/messages_test2.yml")); // when messages.loadSettings(settings); diff --git a/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java b/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java index 1ee5a50c0..4663b2145 100644 --- a/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/settings/NewSettingIntegrationTest.java @@ -32,11 +32,11 @@ import static org.junit.Assert.assertThat; public class NewSettingIntegrationTest { /** File name of the sample config including all {@link TestConfiguration} values. */ - private static final String COMPLETE_FILE = "/config-sample-values.yml"; + private static final String COMPLETE_FILE = TestHelper.PROJECT_ROOT + "settings/config-sample-values.yml"; /** File name of the sample config missing certain {@link TestConfiguration} values. */ - private static final String INCOMPLETE_FILE = "/config-incomplete-sample.yml"; + private static final String INCOMPLETE_FILE = TestHelper.PROJECT_ROOT + "settings/config-incomplete-sample.yml"; /** File name for testing difficult values. */ - private static final String DIFFICULT_FILE = "/config-difficult-values.yml"; + private static final String DIFFICULT_FILE = TestHelper.PROJECT_ROOT + "settings/config-difficult-values.yml"; private static PropertyMap propertyMap = TestConfiguration.generatePropertyMap(); diff --git a/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java b/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java index c489e785f..941c30f18 100644 --- a/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java +++ b/src/test/java/fr/xephi/authme/settings/SpawnLoaderTest.java @@ -54,7 +54,7 @@ public class SpawnLoaderTest { public void setup() throws IOException { // Copy test config into a new temporary folder testFolder = temporaryFolder.newFolder(); - File source = TestHelper.getJarFile("/spawn/spawn-firstspawn.yml"); + File source = TestHelper.getJarFile(TestHelper.PROJECT_ROOT + "settings/spawn-firstspawn.yml"); File destination = new File(testFolder, "spawn.yml"); Files.copy(source, destination); diff --git a/src/test/resources/initialization/config.test.yml b/src/test/resources/fr/xephi/authme/config.test.yml similarity index 100% rename from src/test/resources/initialization/config.test.yml rename to src/test/resources/fr/xephi/authme/config.test.yml diff --git a/src/test/resources/converter/crazylogin.db b/src/test/resources/fr/xephi/authme/converter/crazylogin.db similarity index 100% rename from src/test/resources/converter/crazylogin.db rename to src/test/resources/fr/xephi/authme/converter/crazylogin.db diff --git a/src/test/resources/datasource-integration/flatfile-test.txt b/src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt similarity index 100% rename from src/test/resources/datasource-integration/flatfile-test.txt rename to src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt diff --git a/src/test/resources/datasource-integration/sql-initialize.sql b/src/test/resources/fr/xephi/authme/datasource/sql-initialize.sql similarity index 100% rename from src/test/resources/datasource-integration/sql-initialize.sql rename to src/test/resources/fr/xephi/authme/datasource/sql-initialize.sql diff --git a/src/test/resources/messages_default.yml b/src/test/resources/fr/xephi/authme/output/messages_default.yml similarity index 100% rename from src/test/resources/messages_default.yml rename to src/test/resources/fr/xephi/authme/output/messages_default.yml diff --git a/src/test/resources/messages_test.yml b/src/test/resources/fr/xephi/authme/output/messages_test.yml similarity index 100% rename from src/test/resources/messages_test.yml rename to src/test/resources/fr/xephi/authme/output/messages_test.yml diff --git a/src/test/resources/messages_test2.yml b/src/test/resources/fr/xephi/authme/output/messages_test2.yml similarity index 100% rename from src/test/resources/messages_test2.yml rename to src/test/resources/fr/xephi/authme/output/messages_test2.yml diff --git a/src/test/resources/config-difficult-values.yml b/src/test/resources/fr/xephi/authme/settings/config-difficult-values.yml similarity index 100% rename from src/test/resources/config-difficult-values.yml rename to src/test/resources/fr/xephi/authme/settings/config-difficult-values.yml diff --git a/src/test/resources/config-incomplete-sample.yml b/src/test/resources/fr/xephi/authme/settings/config-incomplete-sample.yml similarity index 100% rename from src/test/resources/config-incomplete-sample.yml rename to src/test/resources/fr/xephi/authme/settings/config-incomplete-sample.yml diff --git a/src/test/resources/config-sample-values.yml b/src/test/resources/fr/xephi/authme/settings/config-sample-values.yml similarity index 100% rename from src/test/resources/config-sample-values.yml rename to src/test/resources/fr/xephi/authme/settings/config-sample-values.yml diff --git a/src/test/resources/spawn/spawn-firstspawn.yml b/src/test/resources/fr/xephi/authme/settings/spawn-firstspawn.yml similarity index 100% rename from src/test/resources/spawn/spawn-firstspawn.yml rename to src/test/resources/fr/xephi/authme/settings/spawn-firstspawn.yml