summaryrefslogtreecommitdiffstats
path: root/sangria-log4j/src/test/java/com/tavianator
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-05-06 21:55:51 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-05-06 21:55:51 -0400
commitd08927582d2c36e3da20488df8f262ca03f26c81 (patch)
tree766ba74d26a766a2046499bac3a137fbd332647a /sangria-log4j/src/test/java/com/tavianator
parent173ef17d37be1f8bd583fbc0e527b2a81ff9f6d9 (diff)
parent55e93141ff7f93cbecb341ad49d2811800569e0d (diff)
downloadsangria-d08927582d2c36e3da20488df8f262ca03f26c81.tar.xz
Merge branch 'guice-4-release'
Diffstat (limited to 'sangria-log4j/src/test/java/com/tavianator')
-rw-r--r--sangria-log4j/src/test/java/com/tavianator/sangria/log4j/SangriaLog4jModuleTest.java28
1 files changed, 16 insertions, 12 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..9dbc560 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
@@ -34,6 +34,8 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
+ * Tests for {@link SangriaLog4jModule}.
+ *
* @author Tavian Barnes (tavianator@tavianator.com)
* @version 1.0
* @since 1.0
@@ -57,21 +59,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