方法org.hamcrest.CoreMatchers.is()
已过时。
文档建议使用org.hamcrest.CoreMatchers.isA()
代替。
但是,isA()
似乎完全针对不同的情况。
好吧,无论如何,回到我的问题。以前我使用以下方式使用is()
// might be i should not be using it like this, but it works.
assertThat(actualRes, is(true));
现在我无法像使用 isA()
一样使用它。它会抛出编译错误,指出参数不适用于布尔值。
我知道 isA()
的作用。但是我想知道的是,既然 is()
已经过时了,那么我该使用什么来代替 assertThat(actualRes, is(true))
?
is(java.lang.Class<T> type)
已经被弃用,但是你在这个断言中没有使用那个方法:assertThat(actualRes, Matchers.is(true));
- glytching