More updates to Web testing section

See gh-19647
This commit is contained in:
Rossen Stoyanchev
2020-09-01 08:56:57 +01:00
parent c6b87b3ef4
commit e34c800467
2 changed files with 136 additions and 61 deletions

View File

@@ -58,6 +58,22 @@ public class ModelAssertionTests {
.alwaysExpect(status().isOk())
.build();
@Test
void name() throws Exception {
EntityExchangeResult<Void> result = client.get().uri("/path")
.exchange()
.expectBody().isEmpty();
MockMvcWebTestClient.resultActionsFor(result)
.andExpect(model().attribute("integer", 3))
.andExpect(model().attribute("string", "a string value"))
.andExpect(model().attribute("integer", equalTo(3))) // Hamcrest...
.andExpect(model().attribute("string", equalTo("a string value")))
.andExpect(model().attribute("globalAttrName", equalTo("Global Attribute Value")));
}
@Test
void attributeEqualTo() throws Exception {
performRequest(HttpMethod.GET, "/")