-2

I try to run this a junit test which finally asserts:

ResponseExample responseExample = new ResponseExample();
responseExample.value = 4;

assertThat(comparisonResult.latencyDelta.best.get(0),equalTo(responseExample));

where

public List<ResponseExample> best;

why do I get error for equalTo() ?

first item in best is of type 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>)
Elad Benda
  • 35,076
  • 87
  • 265
  • 471

1 Answers1

0

I imported "CoreMatchers" and I should have imported "Matcher"

Elad Benda
  • 35,076
  • 87
  • 265
  • 471