Просмотр исходного кода

Revert "Issue #253: Make the sort test more generic. " (#270)

Matthew Morgan 9 лет назад
Родитель
Сommit
758b365320

+ 0
- 1
exercises/grade-school/build.gradle Просмотреть файл

@@ -7,7 +7,6 @@ repositories {
7 7
 }
8 8
 
9 9
 dependencies {
10
-  testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
11 10
   testCompile "junit:junit:4.12"
12 11
 }
13 12
 test {

+ 8
- 17
exercises/grade-school/src/test/java/SchoolTest.java Просмотреть файл

@@ -1,12 +1,11 @@
1 1
 import org.junit.Ignore;
2 2
 import org.junit.Test;
3 3
 
4
-import java.util.Collection;
4
+import java.util.Arrays;
5 5
 import java.util.HashMap;
6
+import java.util.List;
6 7
 import java.util.Map;
7 8
 
8
-import org.hamcrest.Matcher;
9
-import static org.hamcrest.collection.IsIterableContainingInOrder.*;
10 9
 import static org.hamcrest.CoreMatchers.*;
11 10
 import static org.junit.Assert.*;
12 11
 
@@ -70,22 +69,14 @@ public class SchoolTest {
70 69
   @Ignore
71 70
   @Test
72 71
   public void sortsSchool() {
73
-    school.add("Kyle", 4);
74
-    school.add("Zed", 4);
75
-    school.add("Adam", 4);
76 72
     school.add("Jennifer", 4);
77 73
     school.add("Kareem", 6);
78 74
     school.add("Christopher", 4);
79
-    school.add("Kylie", 3);
80
-    Map<Integer, Matcher> sortedStudents = new HashMap<Integer, Matcher>();
81
-    sortedStudents.put(6, contains("Kareem"));
82
-    sortedStudents.put(4, contains("Adam", "Christopher", "Jennifer", "Kyle", "Zed"));
83
-    sortedStudents.put(3, contains("Kylie"));
84
-
85
-    Map schoolStudents = school.sort();
86
-    for (Map.Entry<?, Matcher> entry : sortedStudents.entrySet()) {
87
-
88
-      assertThat((Collection) schoolStudents.get(entry.getKey()), entry.getValue());
89
-    }
75
+    school.add("Kyle", 3);
76
+    Map<Integer, List<String>> sortedStudents = new HashMap<Integer, List<String>>();
77
+    sortedStudents.put(6, Arrays.asList("Kareem"));
78
+    sortedStudents.put(4, Arrays.asList("Christopher", "Jennifer"));
79
+    sortedStudents.put(3, Arrays.asList("Kyle"));
80
+    assertEquals(school.sort(), sortedStudents);
90 81
   }
91 82
 }