title: ContentType not set in Mockito test
body: <p>I am trying to get a unit test to work with Mockito and Spring MVC on a RESTful GET controller.  Here is my test:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  @WebAppConfiguration
  @ContextConfiguration(locations = {"/test-context.xml","/dataaccess-context.xml"})
  public class FormControllerTest {
  
  private MockMvc mockMvc;
  
  @Autowired
  FormImplBean formBean;
  
  @Mock
  private FormService formServiceMock;
  
  @InjectMocks
  private FormController formController;
  
  @Before
  public void setup() {
      // Process mock annotations
      MockitoAnnotations.initMocks(this);
      // Setup Spring test in standalone mode
      this.mockMvc = MockMvcBuilders.standaloneSetup(formController).build();
  }
  
  @Test
  public void testGet() throws Exception {
      when(formServiceMock.getFormImplById(1)).thenReturn(formBean);
  
      mockMvc.perform(get("/Form/form/{id}", 1))
       .andExpect(status().is2xxSuccessful())
       .andExpect(content().contentType(MediaType.APPLICATION_JSON));
  
      verify(formServiceMock, times(1)).getFormImplById(1);
      verifyZeroInteractions(formServiceMock);
  }
  }
  </code></pre>
  
  <p>And here is my controller method:</p>
  
  <pre><code>@RequestMapping(value = "/form/{formId}", method = RequestMethod.GET)
  @ResponseBody
  public FormImplBean getForm(@PathVariable("formId") int formId ) {
      return formService.getFormImplById(formId);
  }
  </code></pre>
  
  <p>I keep getting:</p>
  
  <pre><code>java.lang.AssertionError: Content type not set
  </code></pre>
  
  <p>Of course when I go an look at the real controller on the server, using firefox developer tools, I see that the content type is set correctly. </p>
  
  <p>I tried adding the produces="application/json"  to the controller but that did not work,  (nor do I think I should have to right?)</p>
  
  <p>Without the content type check, the test passes fine.
  I am using:</p>
  
  <p>Spring 4.2.7 - 
  Mockito 1.10.19 - 
  Jackson 2.7.0 - 
  Junit 4.12</p>
  
  <p>in a maven build</p>
  
  <p>Any Ideas?</p>