assertTrue(Arrays.equals(...)) vs assertArrayEquals

are we supposed to use assertArrayEquals(expectedarray, actualarry)? or we should use assertTrue(Arrays.equals(arr1, arr2))?
or both are correct?

Both work if you want to test equality.
But assertArrayEquals is more concise, tells the reader (your future self) your intention, and provides much more useful error messages when the assertion fails.

Reference what assertArrayEquals does to achieve a good output message:

2 Likes

I see, thanks very much :+1: