@Target(value=FIELD)
@Retention(value=RUNTIME)
@Documented
public @interface WrapWithSpy
Spy.
Example:
@RunWith(GovernatorJunit4ClassRunner.class)
@ModulesForTesting({ SomeTestModule.class })
public class MyTestCase {
@Inject @WrapWithSpy
SomeDependency someDependency;
@Test
public void test() {
someDependency.doSomething();
verify(someDependency, times(1)).doSomething();
}
}
public class SomeTestModule extends AbstractModule {
@Override
protected void configure() {
bind(SomeDependency.class);
}
}
}
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
name
The name of the binding you wish to wrap with a Spy.
|