相关疑难解决方法(0)

初始化模拟对象 - MockIto

有许多方法可以使用MockIto初始化模拟对象.这些中最好的方法是什么?

1.

 public class SampleBaseTestCase {

   @Before public void initMocks() {
       MockitoAnnotations.initMocks(this);
   }
Run Code Online (Sandbox Code Playgroud)

2.

@RunWith(MockitoJUnitRunner.class)
Run Code Online (Sandbox Code Playgroud)

[编辑] 3.

mock(XXX.class);
Run Code Online (Sandbox Code Playgroud)

建议我,如果有任何其他方法比这些更好......

java junit mockito

107
推荐指数
7
解决办法
17万
查看次数

什么是JUnit @Before和@Test

在java中使用Junit @Before@Test注释有什么用?如何在netbeans中使用它们?

java junit annotations

23
推荐指数
2
解决办法
8万
查看次数

标签 统计

java ×2

junit ×2

annotations ×1

mockito ×1