Minor householding in tests

- Add missing test for injector
- Remove redundant Mock fields
This commit is contained in:
ljacqu
2016-06-15 21:24:57 +02:00
parent ac484345a2
commit acd4a772e8
6 changed files with 49 additions and 8 deletions
@@ -316,6 +316,22 @@ public class AuthMeServiceInitializerTest {
initializer.performReloadOnServices();
}
@Test
public void shouldRetrieveExistingInstancesOnly() {
// given
initializer.get(GammaService.class);
// when
AlphaService alphaService = initializer.getIfAvailable(AlphaService.class);
BetaManager betaManager = initializer.getIfAvailable(BetaManager.class);
// then
// was initialized because is dependency of GammaService
assertThat(alphaService, not(nullValue()));
// nothing caused this to be initialized
assertThat(betaManager, nullValue());
}
private void expectRuntimeExceptionWith(String message) {
expectedException.expect(RuntimeException.class);
expectedException.expectMessage(containsString(message));