ContentNegotiationViewResolver

@Test
public void createUser_XML() throws Exception {
	String userJson = "{\\"username\\":\\"cmlee\\", \\"password\\":\\"123\\"}";
	mockMvc.perform(post("/users/create")
			.contentType(MediaType.APPLICATION_JSON_UTF8)
			.accept(MediaType.APPLICATION_XML)
			.content(userJson))
			.andExpect(status().isOk())
			.andExpect(xpath("/User/name").string("cmlee"))
			.andExpect(xpath("/User/password").string("123"));
}

406 에러, http message 컨버터가 없는 경우

스프링 부트

<dependency>
   <groupId>com.fasterxml.jackson.dataformat</groupId>
   <artifactId>jackson-dataformat-xml</artifactId>
   <version>2.9.6</version>
</dependency>

테스트 실패 시 .andDo(print())가 자동 실행