@RunWith(EasyMockRunner.class)
public class ExampleTest {
//目标类
@TestSubject
private ClassUnderTest classUnderTest = new ClassUnderTest(); // 2
@Mock
private Collaborator mock; // 1
@Test
public void testRemoveNonExistingDocument() {
// ... 期望操作
replay(mock);
classUnderTest.removeDocument("Does not exist");
// ... 验证
verify()
}
}
常见注解
@Mock,@TestSubject等
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |