Browse Source

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

Matthew Morgan 9 years ago
parent
commit
758b365320

+ 0
- 1
exercises/grade-school/build.gradle View File

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

+ 8
- 17
exercises/grade-school/src/test/java/SchoolTest.java View File

1
 import org.junit.Ignore;
1
 import org.junit.Ignore;
2
 import org.junit.Test;
2
 import org.junit.Test;
3
 
3
 
4
-import java.util.Collection;
4
+import java.util.Arrays;
5
 import java.util.HashMap;
5
 import java.util.HashMap;
6
+import java.util.List;
6
 import java.util.Map;
7
 import java.util.Map;
7
 
8
 
8
-import org.hamcrest.Matcher;
9
-import static org.hamcrest.collection.IsIterableContainingInOrder.*;
10
 import static org.hamcrest.CoreMatchers.*;
9
 import static org.hamcrest.CoreMatchers.*;
11
 import static org.junit.Assert.*;
10
 import static org.junit.Assert.*;
12
 
11
 
70
   @Ignore
69
   @Ignore
71
   @Test
70
   @Test
72
   public void sortsSchool() {
71
   public void sortsSchool() {
73
-    school.add("Kyle", 4);
74
-    school.add("Zed", 4);
75
-    school.add("Adam", 4);
76
     school.add("Jennifer", 4);
72
     school.add("Jennifer", 4);
77
     school.add("Kareem", 6);
73
     school.add("Kareem", 6);
78
     school.add("Christopher", 4);
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
 }