Reputation: 107
// Dao Interface
public Interface IDao {
public void foo()
}
Mock interface in test class
Upvotes: 1
Views: 165
Reputation: 26512
The myDao
is a package level field so its available in the child class.
In that case you can go for the standard Mockito injection of a mock:
@Mock
IDao daoMock;
@InjectMocks
MySubClass subclass;
@Before
public void init(){
MockitoAnnotations.initMocks(this);
}
@Test
public void test(){
subclass.toCreate();
Mockito.verify(daoMock).create();
}
Upvotes: 1