I'm converting some tests from Mockito 1.x to 2.15.0.
Dealing with the new treatment of "null" values was relatively straightforward for String parameters. It appears to be a little more difficult for Map parameters, but I think I'd have the same problem with any type using type parameters.
I've tried the following alternatives:
anyMap()
isNull()
nullable(Map.class)
(Map<KeyType,ValueType>) nullable(Map.class)
The first was the original before the 2.x conversion. It doesn't match if the value is null. The second works if the value is always null, but I don't like it, as it drops type information in the test. The third seems like it would be correct, but it doesn't compile, as the formal parameter type uses generics. The fourth works, but I don't like the cast being there.
Is there a cleaner solution for this?