Introduce sessionAttributeDoesNotExist in RequestResultMatchers
Analogous to the attributeDoesNotExist() method in ModelResultMatchers, this commit introduces a new sessionAttributeDoesNotExist() method in RequestResultMatchers which asserts that the given attributes are null in the HttpSession. Closes gh-23756
This commit is contained in:
committed by
Sam Brannen
parent
e6f92ae2af
commit
e73344fc71
@@ -65,6 +65,12 @@ public class SessionAttributeAssertionTests {
|
||||
.andExpect(request().sessionAttribute("locale", notNullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSessionAttributeDoesNotExist() throws Exception {
|
||||
this.mockMvc.perform(get("/"))
|
||||
.andExpect(request().sessionAttributeDoesNotExist("myAttr1", "myAttr2"));
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
@SessionAttributes("locale")
|
||||
|
||||
Reference in New Issue
Block a user