A very simple artifact, with no dependencies besides JUnit and Guice, which is intended to make it easier to test your Guice code.
Add the dependency to your pom.xml
:
<dependency>
<groupId>com.carlosbecker</groupId>
<artifactId>guice-junit-test-runner</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
Write your tests:
@RunWith(GuiceTestRunner.class)
@GuiceModules(MyModule.class)
public class MyTest {
@Inject
private Something something;
@Test
public void testItWorks() throws Exception {
Assert.assertThat(something.doSomething(), CoreMatchers.notNullValue());
}
}
And that's it!
Fork repository, make changes, send a pull request. I will review
your changes and apply them to the master
branch shortly. To
avoid frustration, previously build your branch with:
mvn clean install -Pqulice
If you have questions or general suggestions, don't hesitate to submit a new Github issue.