summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-05-06 21:39:59 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-05-06 21:39:59 -0400
commit2abbfaa3e5b1cbfcf8e9f8c4d27d3f6762175459 (patch)
treece65c14e33aacba97fe7e3f88ba075e26806a781
parent9010e2fee46485132e78f5a490b900bfde4d3f9b (diff)
downloadsangria-2abbfaa3e5b1cbfcf8e9f8c4d27d3f6762175459.tar.xz
slf4j, log4j: Fix some tests that "broke" due to Guice fixes.
-rw-r--r--sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java26
-rw-r--r--sangria-slf4j/src/test/java/com/tavianator/sangria/slf4j/SangriaSlf4jModuleTest.java26
2 files changed, 28 insertions, 24 deletions
diff --git a/sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java b/sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java
index a3ecd66..ce6982b 100644
--- a/sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java
+++ b/sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java
@@ -57,21 +57,23 @@ public class SangriaLog4jModuleTest {
assertThat(provider.get().getName(), equalTo(LogManager.ROOT_LOGGER_NAME));
}
+ static class HasProviderMethod extends AbstractModule {
+ @Override
+ protected void configure() {
+ install(new SangriaLog4jModule());
+ }
+
+ @Provides
+ String getLoggerName(Logger logger) {
+ return logger.getName();
+ }
+ }
+
@Test
public void testProviderMethod() {
- Injector injector = Guice.createInjector(new AbstractModule() {
- @Override
- protected void configure() {
- install(new SangriaLog4jModule());
- }
-
- @Provides
- String getLoggerName(Logger logger) {
- return logger.getName();
- }
- });
+ Injector injector = Guice.createInjector(new HasProviderMethod());
- assertThat(injector.getInstance(String.class), equalTo(LogManager.ROOT_LOGGER_NAME));
+ assertThat(injector.getInstance(String.class), equalTo(HasProviderMethod.class.getName()));
}
@Test
diff --git a/sangria-slf4j/src/test/java/com/tavianator/sangria/slf4j/SangriaSlf4jModuleTest.java b/sangria-slf4j/src/test/java/com/tavianator/sangria/slf4j/SangriaSlf4jModuleTest.java
index aaf72b2..07bf068 100644
--- a/sangria-slf4j/src/test/java/com/tavianator/sangria/slf4j/SangriaSlf4jModuleTest.java
+++ b/sangria-slf4j/src/test/java/com/tavianator/sangria/slf4j/SangriaSlf4jModuleTest.java
@@ -58,21 +58,23 @@ public class SangriaSlf4jModuleTest {
assertThat(provider.get().getName(), equalTo(Logger.ROOT_LOGGER_NAME));
}
+ static class HasProviderMethod extends AbstractModule {
+ @Override
+ protected void configure() {
+ install(new SangriaSlf4jModule());
+ }
+
+ @Provides
+ String getLoggerName(Logger logger) {
+ return logger.getName();
+ }
+ }
+
@Test
public void testProviderMethod() {
- Injector injector = Guice.createInjector(new AbstractModule() {
- @Override
- protected void configure() {
- install(new SangriaSlf4jModule());
- }
-
- @Provides
- String getLoggerName(Logger logger) {
- return logger.getName();
- }
- });
+ Injector injector = Guice.createInjector(new HasProviderMethod());
- assertThat(injector.getInstance(String.class), equalTo(Logger.ROOT_LOGGER_NAME));
+ assertThat(injector.getInstance(String.class), equalTo(HasProviderMethod.class.getName()));
}
@Test