Hi,
I'd like to run a unit test where a constant is slightly different than in the standard version. That is, in my default module, the following is
bindConstant().annotatedWith(Names.named("number of players")).to(4);
but in testing, I'd like to try this line instead:
bindConstant().annotatedWith(Names.named("number of players")).to(2);
Id like to achieve that without copying all of the rest of the module. What I really want is a "default" module that is "below" a more specialized module, such that in case of conflict, the specialized module wins (instead of throwing an exception, which is what guice does).
In essence, my question is: how does anybody arrange for more than one module without lots of code duplication?
Update: I've realized that the solution is really to use a factory, rather than a constant in THIS use case. I'd still be interested to learn if there's something like hierarchies of modules in general, though.