0
我有串的队列,我想2级的匹配在一个断言 结合(简化)的代码是这样的编译错误匹配器
Queue<String> strings = new LinkedList<>();
assertThat(strings, both(hasSize(1)).and(hasItem("Some string")));
但是当我编译我得到以下信息:
incompatible types: no instance(s) of type variable(s) T exist so that org.hamcrest.Matcher<java.lang.Iterable<? super T>> conforms to org.hamcrest.Matcher<? super java.util.Collection<? extends java.lang.Object>>
- hasItem返回
Matcher<Iterable<? super T>>
- hasSize返回
Matcher<Collection<? extends E>>
我该如何解决这个问题?