我是 Mockito 的新手。我想模拟这段用 Oracle ADF 编写的代码。
else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
"No Cases found in Queue",null));
}
这是我的模拟:
FacesMessage facesMessageMock = mock(FacesMessage.class);
PowerMockito.mockStatic(FacesContext.class);
PowerMockito.when(FacesContext.getCurrentInstance()).thenReturn(facesContextMock);
但我有这个错误:
org.mockito.exceptions.misusing.MissingMethodInvocationException:
when() requires an argument which has to be 'a method call on a mock'.
请问你能帮帮我吗?