Java 在spring mvc集成测试中执行mockMvc后如何检查受影响的db行
我在SpringMVC中通过SpringJUnit4ClassRunner对控制器方法进行了集成测试:Java 在spring mvc集成测试中执行mockMvc后如何检查受影响的db行,java,spring,testing,tdd,integration-testing,Java,Spring,Testing,Tdd,Integration Testing,我在SpringMVC中通过SpringJUnit4ClassRunner对控制器方法进行了集成测试: @Test public void testUpdateSuccess() throws Exception { Integer pageId = 2; RequestBuilder request = post("/admin/page/update/"+pageId) .param("id", pageId.toString())
@Test
public void testUpdateSuccess() throws Exception {
Integer pageId = 2;
RequestBuilder request = post("/admin/page/update/"+pageId)
.param("id", pageId.toString())
.param("title", "page title 2 edited")
.param("content", "page content 2 edited")
.with(csrf());
mockMvc.perform(request)
.andExpect(status().is3xxRedirection())
.andExpect(MockMvcResultMatchers.flash().attribute("message", "Successfully updated!"));
}
1-如何测试上述测试是否更新了相关数据库行
2-如果在上述测试中适当更新了数据库,测试是否合适