Use MockInjector and package protected scope for dependencies to reduce boilerplate codeWe have been bored to write so much boilerplate code for mocking dependencies in our unit tests. That’s why we have written MockInjector to automatically inject all mocks into our class under test. Think of this class: class MyClass { @Inject Foo foo; @Inject Bar foo; void doSomething() { foo.doSomething(); bar.doAnything(); } } If you want to test doSomething(), you need mock Foo and Bar. The traditional way to do this with Mockito is: