title: Check Map key/values with jsonPath
body: <p>I'm testing a controller that returns a Map</p>
  
  <pre><code>@RequestMapping("/")
  @ResponseBody
  public Map&lt;String, String&gt; getMessages(@RequestBody String foo) {
      Map&lt;String, String&gt; map = boo.getMap(foo);
      return map;
  }
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>...
  resultActions
          .andDo(print())
          .andExpect(status().isOk())
          .andExpect(
                  content().contentTypeCompatibleWith(
                          MediaType.APPLICATION_JSON))
          .andExpect(jsonPath("$", notNullValue()))
          .andExpect(jsonPath(EXPRESSION, equalsTo(foo));
   ...
  </code></pre>
  
  <p>Which expression should I use to read the key and the value from the Map?</p>
  
  <p>Edit:
  A way around to solve it could be:</p>
  
  <pre><code>MvcResult result = resultActions.andReturn();
  MockHttpServletResponse response = result.getResponse();
  String content = response.getContentAsString();
  Gson gson = new Gson();
  Type typeOfT = new TypeToken&lt;Map&gt;() {
  }.getType();
  Map&lt;String, String&gt; map = gson.fromJson(content, typeOfT);
  </code></pre>
  
  <p>And then loop through the map checking the values. But is there a way to do it with <code>jsonPath</code>?</p>