0

Is there any option in AssertJ to make deep assertion of 2-d (N-d) arrays? Pretty much the same as java.util.Arrays#deepEquals() does but with assertion exception and prettified fail message like "element arr1[i][j] expected to be X, but was Y"

Here i found only 1d arrays assertions:

https://github.com/joel-costigliola/assertj-examples/blob/master/assertions-examples/src/test/java/org/assertj/examples/ArrayAssertionsExamples.java

radistao
  • 14,889
  • 11
  • 66
  • 92

3 Answers3

2

Unfortunately, there is no such feature in AssertJ but contributions are welcome. I voted for Kevin Welker suggestion.

Joel Costigliola
  • 6,308
  • 27
  • 35
1

I don't see one, but you could write your own with: AbstractAssert, or using a Comparator and the usingComparator method

Kevin Welker
  • 7,719
  • 1
  • 40
  • 56
1

There is a isDeepEqualTo() method available since 3.17.0. Check out Array2DAssertionsExamples

Kirill
  • 6,762
  • 4
  • 51
  • 81