Question: I am trying to assert that an array of string elements is one of the elements of a 2-dimensional array using the standard **Collection.isIn** matcher provided with Hamcrest library. Unfortunately receiving the following assertion exception: 

```
java.lang.AssertionError: 
Expected: one of {["A", "B", "C"], ["A", "B", "C"]}
   but: was ["A", "B", "C"]

```

**Code:**

```
String[][] expected = new String[][] { { "A", "B", "C" }, { "A", "B", "C" } };
String[] actual = new String[] { "A", "B", "C" };

assertThat(actual, isIn(expected));

```

Can I validate using hamcrest in such a manner? Or do I need to create my own matcher for the given scenario?

Answer: 
Your array may contain the same content as the array in `expected`, but it is not the same object.
I'm guessing the issue is because the method compares objects, and not contents. Basically, even though both have the same content, they are not the same object. [See here in the docs](http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matcher.html#matches(java.lang.Object))

Do this instead:

`String[] actual = new String[]{"A1 C1 E1 F1 J1", "A1 C1 E1 F1 K1", "A1 B1 G1 H1"};
String[][] expected = new String[][]{actual, {"A1 C1 E1 F1 J1", "A1 C1 E1 F1 K1", "A1 B1 G1 H1"}};`