guice-junit-test-runner
![Maven Central](https://camo.githubusercontent.com/5086d3becccb8e45bc8b97074983719c486398731338a8760023a027ba4a739e/68747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f636f6d2e6361726c6f736265636b65722f67756963652d6a756e69742d746573742d72756e6e65722f62616467652e7376673f7374796c653d666c6174)
A very simple artifact, with no dependencies besides JUnit and Guice, which is intended to make it easier to test your Guice code.
Usage
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!
How to contribute
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
Got questions?
If you have questions or general suggestions, don't hesitate to submit a new Github issue.