【发布时间】:2018-11-22 12:37:13
【问题描述】:
我目前正在使用 testng assertEquals 和 softassertion,不,我有一个验证场景,实际是一个完整的 String,而预期是一个子字符串。
代码
assertThat("This is actual string", containsString("expected"));
错误信息
java.lang.NoSuchMethodError:
org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
代码
softAssert.assertEquals("This is actual string", containsString("actual"));
错误信息
java.lang.AssertionError:
以下断言失败:预期 [包含“实际”的字符串] 但找到 [这是实际字符串] 预期:包含“实际”的字符串实际:这是实际字符串
【问题讨论】:
标签: java unit-testing testing testng hamcrest