我正在尝试将整数列表与 Hamcrest 匹配,在线查看了一些示例,但是我遇到了运行时异常。
有人可以让我知道什么是正确的语法吗?
List<Integer> numbers = Arrays.asList( 1, 2, 3, 4, 5 );
assertThat((List<Object>) numbers, hasItem(hasProperty("value", is(1))));
assertThat((List<Object>) numbers, hasItem(hasProperty("value", is(2))));
assertThat((List<Object>) numbers, hasItem(hasProperty("value", is(3))));
assertThat((List<Object>) numbers, hasItem(hasProperty("value", is(4))));
assertThat((List<Object>) numbers, hasItem(hasProperty("value", is(5))));
谢谢