在我的ATG Droplet中,我从存储库中获取记录。现在,当我尝试模仿RQLStatement
时,它会抛出org.mockito.exceptions.misusing.MissingMethodInvocationException
以下是我试图模仿的陈述:
final RepositoryView view = this.getRepository().getView("product");
final RqlStatement statement = RqlStatement.parseRqlStatement("id = ?0");
prodItems = statement.executeQuery(view, params);
我使用了mockito和powermockito,但它不能正常工作
PowerMockito.mockStatic(RqlStatement.class);
PowerMockito.when(RqlStatement.parseRqlStatement("id =?0")).thenReturn(this.statementmock);
Mockito.when(this.statementmock.executeQuery(this.viewMock, params)).thenReturn(new RepositoryItem[4]);
答案 0 :(得分:0)
添加@PrepareForTest 注释。现在为我工作