通过条件跳过单元测试
发表于|更新于
|浏览量:
散步慌言蜚语的人往往隐瞒自己的身份,狡黠地假托世人名字,比如,“世人说” “国外有一种说法” 等等。——培根
分享一个小技巧,我们可以使用
1 | Assumptions.assumeTrue(isConnected(), "Redis is not available. Skipping the test."); |
在单元测试中判断,不满足条件则跳过测试
例如此处就是判断redis是否已连接,为true则会继续往下执行,为false则会skip
相关推荐
2020-07-23
mybatis中if-else
mybatis中if-else要用choose-when-otherwise 12345678<choose> <when test="page !=null and page.orderBy != null and page.orderBy != ''"> ORDER BY ${page.orderBy} </when> <otherwise> ORDER BY a.update_date DESC </otherwise></choose>
2023-04-25
map.put踩坑
辱骂与恐吓绝不是战斗。——鲁迅 今天发现一个坑,原来HashMap的put方法返回值并不是put进去的value,而是被覆盖的value或null 其注释也告诉我们 源码也表示 希望大伙不要跟我一样用错了。。。
2021-01-28
性能有点不错的时间工具类
人们宁愿去关心一个蹩脚电影演员的吃喝拉撒和鸡毛蒜皮,而不愿了解一个普通人波涛汹涌的内心世界。——路遥《平凡的世界》 首先是依赖lang3 123456<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --><dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.11</version></dependency> 然后是工具类 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657package com.ruben.utils;import org.apache...
2021-03-02
引入本地jar包
不管努力的目标是什么,不管他干什么,他单枪匹马总是没有力量的。合群永远是一切善良的人的最高需要。——歌德 对于本地jar包,如何让它加入我们的项目并使用maven的GAV管理起来呢 其实很简单 需要在当前项目根路径(在pom.xml的那层)使用 1mvn install:install-file -Dfile=[本地jar包路径] -DgroupId=[自定义groupId] -DartifactId=[自定义artifactId] -Dversion=[自定义version] -Dpackaging=jar 例如 1mvn install:install-file -Dfile=D:\file\files\Onest-S3-java-SDK.jar -DgroupId=com.move -DartifactId=moveOss -Dversion=1.0 -Dpackaging=jar 再使用我们定义的GAV引入,这样就可以使用我们本地jar了 123456<!-- 移动云对象存储 --><dependency> <gr...
2022-09-07
对接雅虎日语文本校对
青年时种下什么,老年时就收获什么——易卜生 API地址:https://developer.yahoo.co.jp/webapi/jlp/kousei/v2/kousei.html 代码: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758package com.ruben;import cn.hutool.core.map.MapUtil;import cn.hutool.core.text.CharPool;import cn.hutool.core.text.StrPool;import cn.hutool.http.HttpRequest;import cn.hutool.http.HttpUtil;import cn.hutool.json.JSONObject;import cn.hutool.json.JSONUtil;import cn.hutool.log.StaticLog;import cn....
2022-03-04
replace、replaceAll、replaceFirst
一年好景君须记,最是橙黄橘绿时。——苏轼 聊聊这仨很常用的函数 我相信很多人也跟我一样也有个误区,错把replace当成replaceFirst,把replaceAll当成replace 实际上,replace函数会替换掉满足字符串中所有出现过第一个参数中的值的地方 例如: 1234 String string = "ruben love strawberry"; String replace = string.replace("r", "");// uben love stawbey 如果我们只需要替换第一处,则需要使用replaceFirst 例如: 1234 String string = "ruben love strawberry"; String replaceFirst = string.replaceFirst("[A-Za-z0-9]", "");// uben love strawberry 并...
