![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java基础-单元测试
abcwywht
这个作者很懒,什么都没留下…
展开
-
PowerMockito mock interface时报错org.powermock.reflect.exceptions.MethodNotFoundException
用例子说明:有如下接口:public interface MyTest { int plus(int a, String... s);}这样mock这个接口就会报错:org.powermock.reflect.exceptions.MethodNotFoundException: No method found with name 'plus' with parameter types: [ java.lang.Integer ]@Beforepublic void set..原创 2022-03-16 14:51:37 · 3141 阅读 · 0 评论 -
java单元测试之Mock静态方法
用例子说明,例如有下面静态方法public final class AmountUtil {public static String CustomFormatWith2Digits(int amount) {return "1";}单元测试代码,需要说明的是,如果单元测试测试的生产代码方法中用到了例子中的CustomFormatWith2Digits方法,该中方法也是可行的@RunWith(PowerMockRunner.class)@PrepareForTest({Amou转载 2022-03-10 10:54:08 · 5402 阅读 · 2 评论