Created
July 7, 2014 19:09
-
-
Save gissuebot/5d62c7df985395ca3cd4 to your computer and use it in GitHub Desktop.
Migrated attachment for Guice issue 700, comment 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.inject.AbstractModule; | |
import com.google.inject.Guice; | |
import com.google.inject.ImplementedBy; | |
import com.google.inject.Inject; | |
import junit.framework.TestCase; | |
public class GuicePocTest extends TestCase { | |
@ImplementedBy(AImpl.class) static interface A { } | |
static class AImpl implements A {} | |
@ImplementedBy(BImpl.class) static interface B { } | |
static class BImpl implements B { | |
@Inject BImpl(A a) {} | |
} | |
public void testProofOfConcept() { | |
assertNotNull(Guice.createInjector(new AbstractModule() { | |
@Override protected void configure() { | |
binder().requireExplicitBindings(); | |
bind(B.class); | |
bind(A.class); | |
} | |
}).getInstance(B.class)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment