![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
junit
躁动的青年
招女朋友
展开
-
JUNIT4 模拟session
一、方式一//需要Servlet 3.0,如果项目是Servlet 2.5,引入测试依赖Servlet 3.0即可。//MockHttpServletRequest request =new MockHttpServletRequest();//MockHttpServletResponse response = new MockHttpServletResponse();MockHttpSession session = new MockHttpSession();依赖<dep原创 2021-04-07 16:27:28 · 944 阅读 · 0 评论 -
JUNIT4 断言assertThat greaterThan
使用assertThat,项目要引用一下jar包junit-4.12.jarhamcrest-core-1.3.jarhamcrest-libriry-1.3.jarpom.xml<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test&原创 2021-04-07 15:55:00 · 888 阅读 · 0 评论 -
spring4.x使用junit4,事务自动回滚
使用事务需要继承AbstractTransactionalJUnit4SpringContextTests@Rollback事务自动回滚import java.util.List;import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factor...原创 2020-05-15 08:36:16 · 127 阅读 · 0 评论