我正在尝试使用JMockit JMockit模拟java.awt.Toolkit.beep()。我的测试用例中有以下代码:
new Expectations() {
Toolkit mock;
{
mock.beep();
}
}.endRecording();当我运行测试用例(JUnit 4)时,我在“新期望”行得到以下异常:
java.lang.ClassFormatError: Code attribute in native or abstract methods in class file $Mock有什么想法吗?
发布于 2009-04-26 16:37:02
默认的jmock只能模拟接口。要模拟类,您需要遵循these instructions
https://stackoverflow.com/questions/791080
复制相似问题