i set up a mock with the following 2 answers (it's gwt related):
when(hMapper.getToken(any(DynamicTablePlace.class))).thenReturn(DYNAMIC_CONTENT);
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
NewNavigationPlace place = (NewNavigationPlace) invocation.getArguments()[0];
return place.getAgsToken() + "," + place.getTopicToken() + "," + place.getDownloadOption();
}
}).when(hMapper).getToken(any(NewNavigationPlace.class));
The Problem is that the answer method is not only be called for "NewNavigationPlace" but also for "DynamicTablePlace" but in the latter case " invocation.getArguments()[0]" is null and so i get a null pointer exception.
Is this working as intended? What i did wrong?
thx in advance