Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近试图在一项测试中断言不等式。但是我无法在 hamcrest 中找到合适的匹配器。我理想地想做的是类似的事情。
assertThat(2 , isNot(3));
有什么办法吗?
您快到了:
assertThat(2 , is(not(3)));
确保导入它:
import static org.hamcrest.CoreMatchers.not;