mardi 18 juillet 2017

Compilation error when trying to combine hamcrest matchers

I have a Queue of string and I want to combine 2 matchers in a single assert The (simplified) code is something like this

    Queue<String> strings = new LinkedList<>();
    assertThat(strings, both(hasSize(1)).and(hasItem("Some string")));

but when I compile it I get the following message: incompatible types: no instance(s) of type variable(s) T exist so that org.hamcrest.Matcher> conforms to org.hamcrest.Matcher>

hasItem retruns Matcher> hasSize returns Matcher>

how can I resolve this?

Aucun commentaire:

Enregistrer un commentaire