Export to GitHub

hamcrest - issue #206

Matchers.arrayContaining(Matcher...) does not work with primitive arrays


Posted on Apr 18, 2014 by Quick Giraffe

The following fails to match:

    int[] primitiveArray = { 1, 2 };
    Matcher matcher = Matchers.arrayContaining(Matchers.equalTo(Integer.valueOf(1)),
            Matchers.equalTo(Integer.valueOf(2)));
    assertTrue(matcher.matches(primitiveArray));

The JavaDoc for arrayContaining(Matcher...) does not indicate this is not supported. Either a bug in the docs, or a bug in the implementation.

Status: New