Annotation Type DefineMock


@Target(FIELD)
@Retention(RUNTIME)
@Documented
public @interface DefineMock
Similar to org.mockito.Mock, for use with testng+guice.
   @Guice(moduleFactory = MyLibraryModuleFactory.class)
   public class MyLibraryIntegrationTests{

       @BindMock
       @Inject
       private MyDependency myDependency;
       @Inject
       private MyLibrary myLibrary;

       @Test
       public void test(){
           Mockito.doReturn(true).when(myDependency).foo();
           myLibrary.bar();
       }
   }
 
  • Element Details

    • answer

      org.mockito.Answers answer
      Default:
      RETURNS_DEFAULTS
    • name

      String name
      Default:
      ""
    • extraInterfaces

      Class<?>[] extraInterfaces
      Default:
      {}