title: mocking a parametrized map in mockito
body: <p>I have a map that looks like this <code>Map&lt;String, Class&lt;? extends TypeA&gt;&gt; differentTypesOfA;</code> <br/>I have different subclasses of TypeA </p>
  
  <p><code>Class TypeB implements TypeA {..}</code> <br/>
  <code>Class TypeC implements TypeA {..}</code>
  and so on</p>
  
  <p>I put them into the map somewhere <code>differentTypesOfA.put("TypeB",TypeB.class)</code> <br/></p>
  
  <p>Now I am trying to mock this map with </p>
  
  <p><code>@Mock Map&lt;String, Class&lt;? extends TypeA&gt;&gt; differentTypesOfAMock;</code> and then <br/>
  <code>.. setup() {</code>
  <code>when(differentTypesOfAMock.get(anyString()).thenReturn(TypeB.class);</code><br/>
  <code>}</code></p>
  
  <p>This of course doesn't work but I can't figure out a nice way of mocking this map either. Can someone help?</p>