public interface AddWork {
int addWork(int a,int b);
}
一个简单的接口
@Test
public void addtest2() {
AddWork work = Mockito.mock(AddWork.class);
Mockito.when(work.addWork(1, 2)).thenReturn(3);
int result = work.addWork(1, 2);
Mockito.verify(work).addWork(1, 2);
Assert.assertEquals(3, result);
}
Mockito生成mock对象