一次单体测试的采坑--MatcherAssert.assertThat---org.hamcrest 和org.mockito
作者:互联网
单体测试测试环境ci上报这个错, 本地没问题.
org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
基本确定是环境问题.
因为本地用idea跑, 服务器用maven跑.
-----------------------------------------------------------------------
google找找答案,
可以用.
稍微改一下, 因为版本已经千差万别了.
查一下mvn dependency:tree -Dscope=test,看到了:
淘宝的fastdfs client里包含了这个引用.
找到.m2目录下这个包,
解压一下:
果然, 有个hamcrest, NND 真TM害人.
以后看到这种带all的都要留意一下, 不知道他整合了写虾米.
反编译对比一下:
再看看正式版, 还是差了好多东西, 比如我在代码里用的
MatcherAsset这个类就没有, 编译时找到了对的jar包, 运行时, 去找了mockito-all里的hamcrest
下面是正式版
标签:assertThat,采坑,一下,mockito,单体,正式版,org,hamcrest 来源: https://www.cnblogs.com/tekikesyo/p/10752041.html