1
Im JUnit-Test unter ich die Validierung, dass ein Modell Attribut vorhanden ist, hat einen bestimmten Typ und ein bestimmtes Attribut:Wie kann ich testen, ob eine Eigenschaft eines Modellattributs bei der Verwendung von JUnit und MockMVC nicht null ist?
@Test
public void myTest() throws Exception {
mockMvc.perform(get(MY_URL))
.andExpect(status().is2xxSuccessful())
.andExpect(view().name(MY_VIEW_NAME))
.andExpect(model().attribute("myForm", instanceOf(MyForm.class)))
.andExpect(model().attribute("myForm", hasProperty("myProp")));
}
Wie teste ich dann, dass diese Eigenschaft nicht null ist?