📜  在 junit 测试中如何测试是否返回空列表 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:30.947000             🧑  作者: Mango

代码示例1
You can simply use

assertFalse(result.isEmpty());
or
assertThat(items, IsCollectionWithSize.hasSize(greaterThan(1)))
Regarding your problem, it's simply caused by the fact that you forgot to statically import the is() method from Hamcrest;

import static org.hamcrest.CoreMatchers.is;