mockitoを使用すると、コードに以下のエラーが表示されました。
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at org.powermock.api.mockito.internal.PowerMockitoCore.doAnswer(PowerMockitoCore.java:36)
E.g. thenReturn() may be missing.
Examples of correct stubbing:
when(mock.isOk()).thenReturn(true);
when(mock.isOk()).thenThrow(exception);
doThrow(exception).when(mock).someVoidMethod();
Hints:
1. missing thenReturn()
2. you are trying to stub a final method, you naughty developer!
3: you are stubbing the behaviour of another mock inside before 'thenReturn' instruction if completed
これを引き起こしたスタック トレース:
PageCodeBase mockPageCodeBase = Mockito.mock(PageCodeBase.class);
Map<String, String> nn = getStringV();
when(mockPageCodeBase.getRequestParam()).thenReturn(nn);
private Map<String, String> getStringV(){
Map<String, String> mapV = new HashMap<String, String>();
mapV.put("selectedApplicantId", "selectedApplicantId");
return mapV;
}
ここで何か見逃しましたか