木小鱼的笔记 2018-08-30
https://blog.csdn.net/u013041642/article/details/71430293
2.mock的使用
Jmock使用:https://www.cnblogs.com/wangtj-19/p/5822092.html
中文网:http://jmockit.cn/showChannel.htm?channel=1
实例:http://www.51testing.com/html/05/n-3721305.html
修改静态变量
Deencapsulation.setField(ClassWithConstant.class, 43);//修改类变量
Deencapsulation.setField(directCollectTaskCentre, "TASK_POOL_SIZE", count);//修改实例的变量
单元测试头注解
@RunWith(JMockit.class)
或者
@RunWith(SpringJUnit4ClassRunner.class) // 使用junit4进行测试
@ContextConfiguration(locations = { "classpath:spring-mvc.xml" }) // 加载配置文件
@BeforeClass
public static void initTestCase() {}
@AfterClass
public static void releaseTestCase(){}
@Before
public void setUp() {}
@After
public void tearDown() {}
特殊注解:https://blog.csdn.net/happymff/article/details/76945139
any强转,anyLong
new MockUp<T >(T.class){
@Mock
public void offer(Invocation invocation, ...){
invocation.proceed(info, originTaskInfo);
}
}
eclipse单元测试覆盖率插件java code coverage-emm
https://blog.csdn.net/devil_wangyu/article/details/78854325