1

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.

Ip Man
  • 77
  • 10

1 Answers1

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));