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

Merge pull request #1179 from sjwarner-bp/anagram-update

anagram: update tests to 1.1.0
FridaTveit 8 лет назад
Родитель
Сommit
60141e5b99
Аккаунт пользователя с таким Email не найден
2 измененных файлов: 37 добавлений и 35 удалений
  1. 1
    0
      exercises/anagram/.meta/version
  2. 36
    35
      exercises/anagram/src/test/java/AnagramTest.java

+ 1
- 0
exercises/anagram/.meta/version Просмотреть файл

1
+1.1.0

+ 36
- 35
exercises/anagram/src/test/java/AnagramTest.java Просмотреть файл

28
 
28
 
29
     @Ignore("Remove to run test")
29
     @Ignore("Remove to run test")
30
     @Test
30
     @Test
31
-    public void testDetectLongerAnagram() {
32
-        Anagram detector = new Anagram("listen");
33
-        List<String> anagrams = detector.match(Arrays.asList("enlists", "google", "inlets", "banana"));
34
-        assertThat(anagrams, hasItem("inlets"));
31
+    public void testDoesNotConfuseDifferentDuplicates() {
32
+        Anagram detector = new Anagram("galea");
33
+        assertTrue(detector.match(Collections.singletonList("eagle")).isEmpty());
35
     }
34
     }
36
 
35
 
37
     @Ignore("Remove to run test")
36
     @Ignore("Remove to run test")
44
 
43
 
45
     @Ignore("Remove to run test")
44
     @Ignore("Remove to run test")
46
     @Test
45
     @Test
47
-    public void testDetectMultipleAnagramsForLongerWord() {
48
-        Anagram detector = new Anagram("allergy");
49
-        List<String> anagrams = detector.match(Arrays.asList("gallery", "ballerina", "regally", "clergy", "largely", "leading"));
50
-        assertThat(anagrams, allOf(hasItem("gallery"), hasItem("largely"), hasItem("regally")));
46
+    public void testEliminateAnagramSubsets() {
47
+        Anagram detector = new Anagram("good");
48
+        assertTrue(detector.match(Arrays.asList("dog", "goody")).isEmpty());
51
     }
49
     }
52
 
50
 
53
     @Ignore("Remove to run test")
51
     @Ignore("Remove to run test")
54
     @Test
52
     @Test
55
-    public void testDoesNotConfuseDifferentDuplicates() {
56
-        Anagram detector = new Anagram("galea");
57
-        assertTrue(detector.match(Collections.singletonList("eagle")).isEmpty());
53
+    public void testDetectLongerAnagram() {
54
+        Anagram detector = new Anagram("listen");
55
+        List<String> anagrams = detector.match(Arrays.asList("enlists", "google", "inlets", "banana"));
56
+        assertThat(anagrams, hasItem("inlets"));
57
+    }
58
+
59
+    @Ignore("Remove to run test")
60
+    @Test
61
+    public void testDetectMultipleAnagramsForLongerWord() {
62
+        Anagram detector = new Anagram("allergy");
63
+        List<String> anagrams = detector.match(Arrays.asList("gallery", "ballerina", "regally", "clergy", "largely", "leading"));
64
+        assertThat(anagrams, allOf(hasItem("gallery"), hasItem("regally"), hasItem("largely")));
58
     }
65
     }
59
 
66
 
60
     @Ignore("Remove to run test")
67
     @Ignore("Remove to run test")
68
 
75
 
69
     @Ignore("Remove to run test")
76
     @Ignore("Remove to run test")
70
     @Test
77
     @Test
71
-    public void testIdenticalWordRepeatedIsNotAnagram() {
72
-        Anagram detector = new Anagram("go");
73
-        assertTrue(detector.match(Collections.singletonList("go Go GO")).isEmpty());
74
-    }
75
-
76
-    @Ignore("Remove to run test")
77
-    @Test
78
-    public void testCapitalWordIsNotOwnAnagram() {
79
-        Anagram detector = new Anagram("BANANA");
80
-        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
81
-    }
82
-
83
-    @Ignore("Remove to run test")
84
-    @Test
85
     public void testEliminateAnagramsWithSameChecksum() {
78
     public void testEliminateAnagramsWithSameChecksum() {
86
         Anagram detector = new Anagram("mass");
79
         Anagram detector = new Anagram("mass");
87
         assertTrue(detector.match(Collections.singletonList("last")).isEmpty());
80
         assertTrue(detector.match(Collections.singletonList("last")).isEmpty());
89
 
82
 
90
     @Ignore("Remove to run test")
83
     @Ignore("Remove to run test")
91
     @Test
84
     @Test
92
-    public void testEliminateAnagramSubsets() {
93
-        Anagram detector = new Anagram("good");
94
-        assertTrue(detector.match(Arrays.asList("dog", "goody")).isEmpty());
85
+    public void testCaseInsensitiveWhenBothAnagramAndSubjectStartWithUpperCaseLetter() {
86
+        Anagram detector = new Anagram("Orchestra");
87
+        List<String> anagrams = detector.match(Arrays.asList("cashregister", "Carthorse", "radishes"));
88
+        assertThat(anagrams, hasItem("Carthorse"));
95
     }
89
     }
96
 
90
 
97
     @Ignore("Remove to run test")
91
     @Ignore("Remove to run test")
112
 
106
 
113
     @Ignore("Remove to run test")
107
     @Ignore("Remove to run test")
114
     @Test
108
     @Test
115
-    public void testCaseInsensitiveWhenBothAnagramAndSubjectStartWithUpperCaseLetter() {
116
-        Anagram detector = new Anagram("Orchestra");
117
-        List<String> anagrams = detector.match(Arrays.asList("cashregister", "Carthorse", "radishes"));
118
-        assertThat(anagrams, hasItem("Carthorse"));
109
+    public void testWordIsNotItsOwnAnagram() {
110
+        Anagram detector = new Anagram("banana");
111
+        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
119
     }
112
     }
120
 
113
 
121
     @Ignore("Remove to run test")
114
     @Ignore("Remove to run test")
122
     @Test
115
     @Test
123
-    public void testWordIsNotItsOwnAnagram() {
124
-        Anagram detector = new Anagram("banana");
125
-        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
116
+    public void testIdenticalWordRepeatedIsNotAnagram() {
117
+        Anagram detector = new Anagram("go");
118
+        assertTrue(detector.match(Collections.singletonList("go Go GO")).isEmpty());
126
     }
119
     }
127
 
120
 
128
     @Ignore("Remove to run test")
121
     @Ignore("Remove to run test")
131
         Anagram detector = new Anagram("tapper");
124
         Anagram detector = new Anagram("tapper");
132
         assertTrue(detector.match(Collections.singletonList("patter")).isEmpty());
125
         assertTrue(detector.match(Collections.singletonList("patter")).isEmpty());
133
     }
126
     }
127
+
128
+    @Ignore("Remove to run test")
129
+    @Test
130
+    public void testCapitalWordIsNotOwnAnagram() {
131
+        Anagram detector = new Anagram("BANANA");
132
+        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
133
+    }
134
+
134
 }
135
 }