I would recommend using Modules.override
here, which has documentation about its use for functional testing. Use it sparingly, as things can get very messy and hard-to-follow otherwise, but it would look like this:
@Before
public void createInjector() {
this.injector = Guice.createInjector(
Modules.override(new YourZABCDModule()).with(new AbstractModule() {
@Override public void configure() {
bind(B.class).to(FakeB.class);
}
}));
}
Or, as in the Modules.override
documentation, just use smaller modules for more-granular combinations:
@Before
public void createInjector() {
this.injector = Guice.createInjector(
new ZAModule(),
new FakeBModule(),
new CModule(),
new DModule());
}