I need to verify that data is sorted according to rule that all null values are in the end of the list. Is any appropriate method exist for it in assertj? I don't want to write something like - I am looking for first null in the list and then verify that all next values are nulls as well.
Asked
Active
Viewed 97 times
1 Answers
4
I think you can use the below code it's just an example I have not tested it yet.
assertThat(actual).isSortedAccordingTo(Ordering.natural().nullsLast().isOrdered(list));

Fahad Aslam
- 56
- 2