我尝试运行这个最终断言的junit测试:
ResponseExample responseExample = new ResponseExample();
responseExample.value = 4;
assertThat(comparisonResult.latencyDelta.best.get(0),equalTo(responseExample));
,其中
public List<ResponseExample> best;
为什么我会收到equalTo()
的错误?
最好的第一项是ResponseExample
Error:(62, 9) java: no suitable method found for assertThat(com.w.routing.automation.dataModel.examples.ResponseExample,com.google.common.base.Predicate<com.w.routing.automation.dataModel.examples.ResponseExample>)
method org.junit.Assert.<T>assertThat(java.lang.String,T,org.hamcrest.Matcher<? super T>) is not applicable
(cannot infer type-variable(s) T
(actual and formal argument lists differ in length))
method org.junit.Assert.<T>assertThat(T,org.hamcrest.Matcher<? super T>) is not applicable
(no instance(s) of type variable(s) T exist so that com.google.common.base.Predicate<T> conforms to org.hamcrest.Matcher<? super T>)
答案 0 :(得分:0)
我导入了“CoreMatchers”,我应该导入“Matcher”