new Builder()
.name("bind A to PlainA")
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(A.class).to(PlainA.class);
scoper.configure(sbb);
}
})
.scoper(scoper)
.addToSuite(suite);
new Builder()
.name("bind A to PlainAProvider.class")
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(A.class).toProvider(PlainAProvider.class);
scoper.configure(sbb);
}
})
.scoper(scoper)
.addToSuite(suite);
new Builder()
.name("bind A to new PlainAProvider()")
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(A.class).toProvider(new PlainAProvider());
scoper.configure(sbb);
}
})
.scoper(scoper)
.addToSuite(suite);
new Builder()
.name("bind AWithProvidedBy")
.key(Key.get(AWithProvidedBy.class), InjectsAWithProvidedBy.class)
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(AWithProvidedBy.class);
scoper.configure(sbb);
}
})
.scoper(scoper)
.addToSuite(suite);
new Builder()
.name("bind AWithImplementedBy")
.key(Key.get(AWithImplementedBy.class), InjectsAWithImplementedBy.class)
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(AWithImplementedBy.class);
scoper.configure(sbb);
}
})
.scoper(scoper)
.addToSuite(suite);
new Builder()
.name("bind ScopedA")
.key(Key.get(ScopedA.class), InjectsScopedA.class)
.module(new AbstractModule() {
protected void configure() {
ScopedBindingBuilder sbb = bind(ScopedA.class);
scoper.configure(sbb);
}
})
.expectedValues(new PlainA(201), new PlainA(201), new PlainA(202), new PlainA(202))
.scoper(scoper)