Given that:
int[] a = {1, 2, 3, 4};
int[] b = {1, 2, 3, 4, 5};
How to asser that "a" is a subset of "b" using hamcrest matchers?
The following works
assertThat(Arrays.asList(b), hasItems(a));
But since I am creating "a" from "b", I would prefer to apply the asserts on "a" as the value. Something like
assertThat(a, isSubsetOf(b));
Additionally it is preferable to avoid converting the array to a list.
a
contains two3
values butb
only contains one, the above would give a false positive. – Nigger