Search code examples
javajunitguicecode-injection

Guice injector in JUnit tests


Using Guice, is it a good practice to get a new injector in each JUnit test class, as each test class should be independant?


Solution

  • Take a look at Guice Berry.

    I won't recommend using it now (documentation is really terrible), but looking at their approach can make you think clear about how DI should be done in jUnit.