This library enables Dagger works like @Guice. Inspired by hk2-testng.
Add it as a test
-scoped dependency.
<dependency>
<groupId>com.github.jinahya</groupId>
<artifactId>dagger-testng</artifactId>
<scope>test</scope>
</dependency>
You, of course, should add related dependencies by yourself.
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
Use it just like you would do with @Guice
or @HK2
.
@Dagger(modules = MyModule.class)
public class MyTest {
@Test
public void test() {
}
@Inject
String name;
}
[![Domate via Paypal](https://img.shields.io/badge/donate-paypal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=A954LDFBW4B9N&lc=KR&item_name=GitHub&amount=5%2e00¤cy_code=USD&button_subtype=products&add=1&bn=PP%2dShopCartBF%3adonate%2dpaypal%2dblue%2epng%3aNonHosted)