|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2018 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. |
|
|
|
|
@ -40,14 +40,21 @@ public interface ResultActions {
@@ -40,14 +40,21 @@ public interface ResultActions {
|
|
|
|
|
* .andExpect(status().isOk()) |
|
|
|
|
* .andExpect(content().contentType(MediaType.APPLICATION_JSON)) |
|
|
|
|
* .andExpect(jsonPath("$.person.name").value("Jason")); |
|
|
|
|
* </pre> |
|
|
|
|
* |
|
|
|
|
* <p>Or alternatively provide all matchers as a vararg: |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* static imports: MockMvcRequestBuilders.*, MockMvcResultMatchers.*, ResultMatcher.matchAll |
|
|
|
|
* |
|
|
|
|
* mockMvc.perform(post("/form")) |
|
|
|
|
* .andExpect(status().isOk()) |
|
|
|
|
* .andExpect(redirectedUrl("/person/1")) |
|
|
|
|
* .andExpect(model().size(1)) |
|
|
|
|
* .andExpect(model().attributeExists("person")) |
|
|
|
|
* .andExpect(flash().attributeCount(1)) |
|
|
|
|
* .andExpect(flash().attribute("message", "success!")); |
|
|
|
|
* .andExpect(matchAll( |
|
|
|
|
* status().isOk(), |
|
|
|
|
* redirectedUrl("/person/1"), |
|
|
|
|
* model().size(1), |
|
|
|
|
* model().attributeExists("person"), |
|
|
|
|
* flash().attributeCount(1), |
|
|
|
|
* flash().attribute("message", "success!")) |
|
|
|
|
* ); |
|
|
|
|
* </pre> |
|
|
|
|
*/ |
|
|
|
|
ResultActions andExpect(ResultMatcher matcher) throws Exception; |
|
|
|
|
|