Merge branch '2.0.x' into 2.1.x

Closes gh-17078
This commit is contained in:
Andy Wilkinson
2019-06-07 10:50:34 +01:00
2691 changed files with 27746 additions and 46049 deletions

View File

@@ -63,8 +63,7 @@ public class MessageController {
}
@PostMapping
public ModelAndView create(@Valid Message message, BindingResult result,
RedirectAttributes redirect) {
public ModelAndView create(@Valid Message message, BindingResult result, RedirectAttributes redirect) {
if (result.hasErrors()) {
ModelAndView mav = new ModelAndView("messages/form");
mav.addObject("formErrors", result.getAllErrors());

View File

@@ -66,15 +66,13 @@ public class MessageControllerWebTests {
@Test
public void testCreate() throws Exception {
this.mockMvc.perform(post("/").param("text", "FOO text").param("summary", "FOO"))
.andExpect(status().isFound())
this.mockMvc.perform(post("/").param("text", "FOO text").param("summary", "FOO")).andExpect(status().isFound())
.andExpect(header().string("location", RegexMatcher.matches("/[0-9]+")));
}
@Test
public void testCreateValidation() throws Exception {
this.mockMvc.perform(post("/").param("text", "").param("summary", ""))
.andExpect(status().isOk())
this.mockMvc.perform(post("/").param("text", "").param("summary", "")).andExpect(status().isOk())
.andExpect(content().string(containsString("is required")));
}
@@ -98,8 +96,7 @@ public class MessageControllerWebTests {
@Override
public void describeTo(Description description) {
description.appendText("a string that matches regex: ")
.appendText(this.regex);
description.appendText("a string that matches regex: ").appendText(this.regex);
}
public static org.hamcrest.Matcher<java.lang.String> matches(String regex) {

View File

@@ -68,8 +68,7 @@ public class SampleGroovyTemplateApplicationTests {
@Test
public void testCss() {
ResponseEntity<String> entity = this.restTemplate
.getForEntity("/css/bootstrap.min.css", String.class);
ResponseEntity<String> entity = this.restTemplate.getForEntity("/css/bootstrap.min.css", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("body");
}