diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XmlContentAssertionTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XmlContentAssertionTests.java index e165975b976..eeeeeb5b3ca 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XmlContentAssertionTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XmlContentAssertionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.ResponseBody; * Examples of defining expectations on XML response content with XMLUnit. * * @author Rossen Stoyanchev - * + * @author Sam Brannen * @see ContentAssertionTests * @see XpathAssertionTests */ @@ -65,9 +65,9 @@ public class XmlContentAssertionTests { @Before public void setup() { this.mockMvc = standaloneSetup(new MusicController()) - .defaultRequest(get("/").accept(MediaType.APPLICATION_XML)) + .defaultRequest(get("/").accept(MediaType.APPLICATION_XML, MediaType.parseMediaType("application/xml;charset=UTF-8"))) .alwaysExpect(status().isOk()) - .alwaysExpect(content().contentType(MediaType.APPLICATION_XML)) + .alwaysExpect(content().contentType(MediaType.parseMediaType("application/xml;charset=UTF-8"))) .build(); } @@ -78,7 +78,6 @@ public class XmlContentAssertionTests { @Test public void testNodeHamcrestMatcher() throws Exception { - this.mockMvc.perform(get("/music/people")) .andExpect(content().node(hasXPath("/people/composers/composer[1]"))); } diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XpathAssertionTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XpathAssertionTests.java index 34ef829bf9f..3ccfe85a2b1 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XpathAssertionTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/XpathAssertionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ import static org.springframework.web.bind.annotation.RequestMethod.*; * Examples of expectations on XML response content with XPath expressions. * * @author Rossen Stoyanchev - * + * @author Sam Brannen * @see ContentAssertionTests * @see XmlContentAssertionTests */ @@ -60,9 +60,9 @@ public class XpathAssertionTests { @Before public void setup() throws Exception { this.mockMvc = standaloneSetup(new MusicController()) - .defaultRequest(get("/").accept(MediaType.APPLICATION_XML)) + .defaultRequest(get("/").accept(MediaType.APPLICATION_XML, MediaType.parseMediaType("application/xml;charset=UTF-8"))) .alwaysExpect(status().isOk()) - .alwaysExpect(content().contentType(MediaType.APPLICATION_XML)) + .alwaysExpect(content().contentType(MediaType.parseMediaType("application/xml;charset=UTF-8"))) .build(); }