1
내 시험 AssertJ을 사용하고
내림차순으로 정렬되어있는 경우 어설와 나는 List<T>
정렬되어있는 경우 확인하는 방법이있다주의 :AssertJ는 : 목록 역 또는 주문
public static <T> void sorted(final List<T> actual) {
try {
assertThat(actual).isSorted();
} catch (AssertionError e) {
LOGGER.error(e.getMessage(), e);
throw e;
}
}
확인하는 방법이 있나요 목록이 내림차순으로 정렬 된 경우?
guava가 Ordering.natural().reverse().isOrdered(values)
을 제공하지만 실제로 디버깅에 많은 도움이되는 AssertJ의 주장 메시지를 활용하고 싶습니다.
group is not sorted because element 5:
<"4000366190001391">
is not less or equal than element 6:
<"4000206280001394">
group was:
<["4000206280001363",
"4000206280001364",
"4000206280001365",
"4000206280001373",
"4000206280001388",
"4000366190001391",
"4000206280001394",
"4000366190001401",
"4000206280001403",
"4000206280001405",
....]>