开发者社区> 问答> 正文

使用powerMockito报错,请哪位大侠指点一下,多谢 ?报错

maven工程,pom里面是这样写的(新手,我也不知道哪个是有用的):

org.mockito
mockito-all
1.10.17
test


org.powermock
powermock-api-mockito
1.6.3
test


org.powermock
powermock-module-junit4
1.6.3


junit
junit


org.powermock
powermock-core


org.powermock
powermock-reflect


test


org.mockito
mockito-core
1.10.17
test


org.mockito
mockito-all
1.10.17
test

代码:
@RunWith(PowerMockRunner.class)
public class SomethingTest
{
@Test
@PrepareForTest({Something.class})
@PowerMockIgnore("javax.management.*")
public void testSomething1() throws Exception
{
SomthingDao dao = PowerMockito.mock(SomthingDao.class); //报错的行号是这里
PowerMockito.whenNew(SomthingDao.class).withNoArguments().thenReturn(dao);

    Something discoverMgr = new Something();
    // 调用被测方法

然后报错说有一个invocationSubstitute.performSubstitutionLogic()方法没有打桩:
org.mockito.configuration.UnstubbedMethodException: invocationSubstitute.performSubstitutionLogic(); was not stubbed

哪位大侠知道是怎么回事的?万分感谢~~~~

展开
收起
爱吃鱼的程序员 2020-06-23 01:24:18 530 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    这排版~~~~~我不是故意的~~
    POM的XML标签不知道去哪了,是pom里面的依赖,依赖的东西和版本号应该还是能看到的

    2020-06-23 01:24:34
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
DBA成长沉思录 立即下载
Java开发手册(泰山版)灵魂13问 立即下载
Java开发手册(泰山版) 立即下载