I am trying to do some unit testing on my controllers. No matter what I do all controller tests return 

```
java.lang.AssertionError: Content type not set

```

I am testing that the methods return json and xml data.

Here is an example of the controller:

```
@Controller
@RequestMapping("/mypath")

public class MyController {

   @Autowired
   MyService myService;

   @RequestMapping(value="/schema", method = RequestMethod.GET)
   public ResponseEntity<MyObject> getSchema(HttpServletRequest request) {

       return new ResponseEntity<MyObject>(new MyObject(), HttpStatus.OK);

   }

}

```

The unit test is set up like this:

```
public class ControllerTest() { 

private static final String path = "/mypath/schema";
private static final String jsonPath = "$.myObject.val";
private static final String defaultVal = "HELLO";

MockMvc mockMvc;

@InjectMocks
MyController controller;

@Mock
MyService myService;

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);

    mockMvc = standaloneSetup(controller)
                .setMessageConverters(new MappingJackson2HttpMessageConverter(),
                        new Jaxb2RootElementHttpMessageConverter()).build();

    when(myService.getInfo(any(String.class))).thenReturn(information);
    when(myService.getInfo(any(String.class), any(Date.class))).thenReturn(informationOld);

}

@Test
public void pathReturnsJsonData() throws Exception {

    mockMvc.perform(get(path).contentType(MediaType.APPLICATION_JSON))
        .andDo(print())
        .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath(jsonPath).value(defaultVal));
}

```

}

I am using:
Spring 4.0.2
Junit 4.11
Gradle 1.12

I have seen the SO question [Similiar Question](https://stackoverflow.com/questions/22183178/java-lang-assertionerror-content-type-not-set-while-junit-spring-mvc-controller) but no matter what combination of contentType and expect in my unit test I get the same result.

Any help would be much appreciated.

Thanks