1

Inside my ATG Droplet, I am fetching records from repository. Now when I try to mock RQLStatement it throws a org.mockito.exceptions.misusing.MissingMethodInvocationException

Below are the statements I am trying to mock:

 final RepositoryView view = this.getRepository().getView("product");

 final RqlStatement statement = RqlStatement.parseRqlStatement("id = ?0");

 prodItems = statement.executeQuery(view, params);

I used mockito and powermockito but its not working

 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]);
4

1 回答 1

0

添加@PrepareForTest 注释。现在为我工作

于 2021-01-20T14:08:19.837 回答