|
1 | 1 | package com.examplehub.sorts;
|
2 | 2 |
|
3 |
| -import static org.junit.jupiter.api.Assertions.assertEquals; |
4 | 3 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
5 | 4 |
|
6 | 5 | import com.examplehub.domain.Student;
|
@@ -54,21 +53,6 @@ void testComparable() {
|
54 | 53 | students[3] = new Student(4, 100, 100, 100);
|
55 | 54 | students[4] = new Student(5, 99, 99, 99);
|
56 | 55 | sort.sort(students);
|
57 |
| - // sort by total score, chinese, math, english |
58 |
| - for (Student item : students) { |
59 |
| - System.out.format( |
60 |
| - "id:%d, totalScore:%d, Chinese:%d, math:%d, english:%d\n", |
61 |
| - item.getId(), |
62 |
| - item.getChinese() + item.getMath() + item.getEnglish(), |
63 |
| - item.getChinese(), |
64 |
| - item.getMath(), |
65 |
| - item.getEnglish()); |
66 |
| - System.out.println(item); |
67 |
| - } |
68 |
| - assertEquals("Student{id=4, Chinese=100, math=100, english=100}", students[0].toString()); |
69 |
| - assertEquals("Student{id=2, Chinese=100, math=99, english=98}", students[1].toString()); |
70 |
| - assertEquals("Student{id=1, Chinese=98, math=99, english=100}", students[2].toString()); |
71 |
| - assertEquals("Student{id=3, Chinese=100, math=98, english=99}", students[3].toString()); |
72 |
| - assertEquals("Student{id=5, Chinese=99, math=99, english=99}", students[4].toString()); |
| 56 | + assertTrue(SortUtils.isSorted(students)); |
73 | 57 | }
|
74 | 58 | }
|
0 commit comments