title: MockMvc no longer handles UTF-8 characters with Spring Boot 2.2.0.RELEASE
body: <p>After I upgraded to the newly released <code>2.2.0.RELEASE</code> version of Spring Boot some of my tests failed. It appears that the <code>MediaType.APPLICATION_JSON_UTF8</code> has been deprecated and is no longer returned as default content type from controller methods that do not specify the content type explicitly.</p>
  
  <p>Test code like</p>
  
  <pre><code>String content = mockMvc.perform(get("/some-api")
              .contentType(MediaType.APPLICATION_JSON))
              .andExpect(status().isOk())
              .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
              .andReturn()
              .getResponse()
              .getContentAsString();
  </code></pre>
  
  <p>suddenly did not work anymore as the content type was mismatched as shown below</p>
  
  <pre><code>java.lang.AssertionError: Content type 
  Expected :application/json;charset=UTF-8
  Actual   :application/json
  </code></pre>
  
  <p>Changing the code to <code>.andExpect(content().contentType(MediaType.APPLICATION_JSON))</code> resolved the issue for now. </p>
  
  <p>But now when comparing <code>content</code> to the expected serialized object there is still a mismatch if there are any special characters in the object. It appears that the <code>.getContentAsString()</code> method does not make use of the UTF-8 character encoding by default (any more).</p>
  
  <pre><code>java.lang.AssertionError: Response content expected:&lt;[{"description":"Er hörte leise Schritte hinter sich."}]&gt; but was:&lt;[{"description":"Er hÃ¶rte leise Schritte hinter sich."}]&gt;
  Expected :[{"description":"Er hörte leise Schritte hinter sich."}]
  Actual   :[{"description":"Er hÃ¶rte leise Schritte hinter sich."}]
  </code></pre>
  
  <p>How can I get <code>content</code> in UTF-8 encoding?</p>