如何解决我的代码抛出 java.lang.IllegalArgumentException: Matching real methods not found for the following mocks 错误
我在下面的代码中做错了什么?有人可以提出建议吗。
@RunWith(JUnit4.class)
class testingClasstest {
//Added annotations on the classes
@InjectMocks
private TestingClass testClassObj;
@Mock
DO dO;
private Exception ex;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
dO = new DO();
}
//method to be tested
@Test
void testProcess() {
dO = new dO();
ex = new MyException(new ArrayList<>(),null);
new MockUp<Mockingclass>() {
@mockit.Mock
public void method(Object obj,String st,Exception ex,String msg,ObjectConfig obj) {
dO.setCd(Interfacecontaingconst.CD);
}
};
testObj.method(DO,"6",ex,null,null);
Assert.assertEquals(139,dO.getCd());
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。