@Test
 public void setCharacterEncodingThenContentType() {
   request.setCharacterEncoding("UTF-8");
   request.setContentType("test/plain");
   assertEquals("test/plain", request.getContentType());
   assertEquals("test/plain;charset=UTF-8", request.getHeader("Content-Type"));
   assertEquals("UTF-8", request.getCharacterEncoding());
 }
 @Test
 public void contentTypeHeaderUTF8() {
   String contentType = "test/plain;charset=UTF-8";
   request.addHeader("Content-Type", contentType);
   assertEquals(contentType, request.getContentType());
   assertEquals(contentType, request.getHeader("Content-Type"));
   assertEquals("UTF-8", request.getCharacterEncoding());
 }
  @Test
  public void contentTypeViaMultipleHeaderValues() throws Exception {
    this.builder.header("Content-Type", MediaType.TEXT_HTML_VALUE, MediaType.ALL_VALUE);
    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
    String contentType = request.getContentType();

    assertEquals("text/html, */*", contentType);
  }
 @Test
 public void contentTypeHeader() {
   String contentType = "test/plain";
   request.addHeader("Content-Type", contentType);
   assertEquals(contentType, request.getContentType());
   assertEquals(contentType, request.getHeader("Content-Type"));
   assertNull(request.getCharacterEncoding());
 }
  @Test
  public void contentType() throws Exception {
    this.builder.contentType(MediaType.TEXT_HTML);

    MockHttpServletRequest request = this.builder.buildRequest(this.servletContext);
    String contentType = request.getContentType();
    List<String> contentTypes = Collections.list(request.getHeaders("Content-Type"));

    assertEquals("text/html", contentType);
    assertEquals(1, contentTypes.size());
    assertEquals("text/html", contentTypes.get(0));
  }