Skip to content

Commit

Permalink
Merge pull request #27238 from izeye
Browse files Browse the repository at this point in the history
* pr/27238:
  Polish printMvcResultsToWriterWithFailingGlobalResultMatcher()

Closes gh-27238
  • Loading branch information
snicoll committed Aug 4, 2021
2 parents ce94f69 + 86ef023 commit 8670b1c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.springframework.web.bind.annotation.RestController;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
Expand Down Expand Up @@ -70,6 +71,7 @@ void printMvcResultsToWriterWithFailingGlobalResultMatcher() throws Exception {
.alwaysExpect(content().string("Boom!"))
.build()
.perform(get("/").content("Hello Request".getBytes()).characterEncoding("ISO-8859-1"));
fail("AssertionError is expected to be thrown.");
}
catch (AssertionError error) {
assertThat(error).hasMessageContaining("Boom!");
Expand Down

0 comments on commit 8670b1c

Please sign in to comment.