title: Mockito: how to pass specific map as argument in when statement?
body: <p>I want to pass a specific <code>map</code>  as argument in <code>when</code> statement. </p>
  
  <pre><code>Map&lt;String, String&gt; someSpecificMap = new HashMap&lt;&gt;;
  
  @Before
      public void setUp() {
  
  
          someSpecificMap.put("key", "value");
  
          when(mockedObject.get(new MapParametersMatcher()).thenReturn(1);
      }
  
      @Test
      public void test() {
          //some code that invokes mocked object and passes into it map with ("key", "value")
      }
  
  
  
      class MapParametersMatcher extends ArgumentMatcher {
  
          @Override
          public boolean matches(Object argument) {
  
              if (argument instanceof Map) {
                  Map&lt;String, String&gt; params = (Map&lt;String, String&gt;) argument;
                  if (!params.get("key").equals("value")) {
                      return false;
                  }
  
              }
  
              return true;
          }
      }
  </code></pre>
  
  <p>But matches() method isn't invoked. And test failed.</p>