#769 Create integration test for service initialization in onEnable()

- Test that services can be instantiated (e.g. no circular dependencies)
- Instantiate Messages via injection instead of manually
This commit is contained in:
ljacqu
2016-06-14 19:09:45 +02:00
parent 2bdd2504df
commit 4b3ab4b116
5 changed files with 568 additions and 28 deletions
@@ -53,7 +53,10 @@ public class MessagesIntegrationTest {
@Before
public void setUpMessages() {
File testFile = TestHelper.getJarFile(YML_TEST_FILE);
messages = new Messages(testFile, YML_DEFAULT_TEST_FILE);
NewSetting settings = mock(NewSetting.class);
given(settings.getMessagesFile()).willReturn(testFile);
given(settings.getDefaultMessagesFile()).willReturn(YML_DEFAULT_TEST_FILE);
messages = new Messages(settings);
}
@Test
@@ -232,7 +235,9 @@ public class MessagesIntegrationTest {
@Test
public void shouldAllowNullAsDefaultFile() {
// given
Messages testMessages = new Messages(TestHelper.getJarFile(YML_TEST_FILE), null);
NewSetting settings = mock(NewSetting.class);
given(settings.getMessagesFile()).willReturn(TestHelper.getJarFile(YML_TEST_FILE));
Messages testMessages = new Messages(settings);
// Key not present in test file
MessageKey key = MessageKey.TWO_FACTOR_CREATE;