Skip to content

Instantly share code, notes, and snippets.

@gissuebot
Created July 7, 2014 19:09
Show Gist options
  • Save gissuebot/5d62c7df985395ca3cd4 to your computer and use it in GitHub Desktop.
Save gissuebot/5d62c7df985395ca3cd4 to your computer and use it in GitHub Desktop.
Migrated attachment for Guice issue 700, comment 0
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