Is there a way to assert that a List contains only/exactly long[] array?
Code:
// arrange
long[] result = {1, 2, 3, 4, 5};
// act
List<Long> digitPowNumbers = SumDigPower.findDigitPowNumbers(1, 6);
// assert
assertThat(digitPowNumbers).containsExactly(result);
}
I'm getting Cannot resolve method containsExactly(long[])
. How can I do this assertion? Is there a way without just typing 1, 2, 3, 4, 5
into containsExactly
?
containsExactly()
expects an array of the same element type as your list, which is Long
, not the primitive long
. Change your array type and it should work:
Long[] result = {1L, 2L, 3L, 4L, 5L};