![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
测试
sunxboy
这个作者很懒,什么都没留下…
展开
-
用mockito来验证方法传参
@Captor private ArgumentCaptor<Map<String, String>> captor; @Before public void init() { MockitoAnnotations.initMocks(this); } public void test() {...原创 2013-11-20 10:54:59 · 1375 阅读 · 0 评论 -
Use cobertura test coverage tool instead of jacoco in sonar
1. download sonar zip , unzip to $SONAR_HOME folder 2. put below xml into settings.xml of maven <profile> <id>sonar</id> <activation> <activeByDefault...原创 2014-01-13 16:39:07 · 93 阅读 · 0 评论 -
Build Spring Unit test by using PowerMock with Mockito
sometimes we need to test final class or static class, at this time we need powermock. 1, update pom.xml to import powermock <dependency> <groupId>org.powermock</groupId> ...原创 2014-01-16 16:44:53 · 141 阅读 · 0 评论 -
How to mock void method using mockito
sometimes, we need to mock void method like this: public void printLine() { //... ... } how to mock it by using mockito ?here it is: Mockito.doNothing().when(handler).printLine(); ...原创 2014-01-17 13:07:28 · 111 阅读 · 0 评论 -
xml configuration of integration test with spring data mongo
1. junit test like below @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/spring/test-mongo-setup.xml"}) public class AlarmLogDataHandlerTest extends AbstractDbDataTest...原创 2014-03-25 08:51:09 · 118 阅读 · 0 评论 -
spring data JPA的写法以及如何 测试
1。 pom 导入测试要用到的包 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> &原创 2015-05-22 10:33:34 · 553 阅读 · 0 评论