I have code that looks like so:
for (Map.Entry<Integer, Action> entry : availableActions.entrySet()) {
...
}
I've tried to mock it like this:
Map mockAvailableActions = mock(Map.class, Mockito.RETURNS_DEEP_STUBS);
mockAvailableActions.put(new Integer(1), mockAction);
I would think that would be enough. But entrySet is empty. So I added this:
when(mockAvailableActions.entrySet().iterator()).thenReturn(mockIterator);
when(mockIterator.next()).thenReturn(mockAction);
Still entrySet is empty. What am I doing wrong? Thanks for any input!