【发布时间】:2014-01-29 14:08:57
【问题描述】:
这与Checking that a List is not empty in Hamcrest有关
我对此有一个疑问 - 如果我们可以断言列表不为空而不使用 Hamcrest 并且仅使用 JUnit 作为:
assertFalse(list.isEmpty());
正在使用
assertThat(list.isEmpty(), is(false));
或
assertThat((Collection)list, is(not(empty())));
值得吗?
我不明白在这种情况下我们使用 Hamcrest 版本是否有所收获?两者是等价的吗?
【问题讨论】:
标签: java collections junit hamcrest