Spring MVC testing: how to check if a model attribute does not exist?
Im using Spring 3.2.11.RELEASE. I am using the new MVC 3.2 mock framework for unit testing and usually I can check the attributes of the model using something like the following ...
private MockMvc mockMvc;
β¦
@Test
public final void test()
{
β¦
mockMvc.perform(get("/mypath")
.param("userId", customerId))
.andExpect(status().isOk())
.andExpect(model().attribute("attr1", "value"))
.andExpect(view().name("my view"));
but how would I adjust the above to make sure the attr1 attribute was not included in my model?
+3
source to share
2 answers