diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resulthandlers/PrintingResultHandlerIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resulthandlers/PrintingResultHandlerIntegrationTests.java index f639774453ad..c21f590f6c0e 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resulthandlers/PrintingResultHandlerIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resulthandlers/PrintingResultHandlerIntegrationTests.java @@ -68,10 +68,10 @@ void printMvcResultsToWriterWithJsonResponseBodyInterpretedAsUtf8() throws Excep standaloneSetup(new SimpleController()).build() // "Hallöchen" is German slang for "hello". - .perform(get("/utf8").accept(MediaType.APPLICATION_JSON).content("Hallöchen, Welt!".getBytes()).characterEncoding(UTF_8)) + .perform(get("/utf8").accept(MediaType.APPLICATION_JSON).content("Hallöchen, Welt!".getBytes(UTF_8)).characterEncoding(UTF_8)) .andDo(print(writer)) // "Grüß dich!" is German for "greetings to you". - .andExpect(content().bytes("Grüß dich!".getBytes())); + .andExpect(content().bytes("Grüß dich!".getBytes(UTF_8))); assertThat(writer).asString() .contains("Body = Hallöchen, Welt!")