我有类似下面的抽象类,我想模拟getBatchSize()方法。
public abstract class AbstractTest {
protected int getBatchSize() throws SQLException {
return 100;
}
}
当尝试使用jmockit进行如下模拟时
new MockUp<AbstractTest>() {
@Mock
protected int getBatchSize() throws SQLException {
throw new SQLException();
}
};
我遇到以下错误:
Caused by: java.lang.UnsupportedOperationException: class redefinition failed: attempted to change method modifiers