|
|
@@ -28,10 +28,9 @@ public class AnagramTest {
|
|
28
|
28
|
|
|
29
|
29
|
@Ignore("Remove to run test")
|
|
30
|
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
|
36
|
@Ignore("Remove to run test")
|
|
|
@@ -44,17 +43,25 @@ public class AnagramTest {
|
|
44
|
43
|
|
|
45
|
44
|
@Ignore("Remove to run test")
|
|
46
|
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
|
51
|
@Ignore("Remove to run test")
|
|
54
|
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
|
67
|
@Ignore("Remove to run test")
|
|
|
@@ -68,20 +75,6 @@ public class AnagramTest {
|
|
68
|
75
|
|
|
69
|
76
|
@Ignore("Remove to run test")
|
|
70
|
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
|
78
|
public void testEliminateAnagramsWithSameChecksum() {
|
|
86
|
79
|
Anagram detector = new Anagram("mass");
|
|
87
|
80
|
assertTrue(detector.match(Collections.singletonList("last")).isEmpty());
|
|
|
@@ -89,9 +82,10 @@ public class AnagramTest {
|
|
89
|
82
|
|
|
90
|
83
|
@Ignore("Remove to run test")
|
|
91
|
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
|
91
|
@Ignore("Remove to run test")
|
|
|
@@ -112,17 +106,16 @@ public class AnagramTest {
|
|
112
|
106
|
|
|
113
|
107
|
@Ignore("Remove to run test")
|
|
114
|
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
|
114
|
@Ignore("Remove to run test")
|
|
122
|
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
|
121
|
@Ignore("Remove to run test")
|
|
|
@@ -131,4 +124,12 @@ public class AnagramTest {
|
|
131
|
124
|
Anagram detector = new Anagram("tapper");
|
|
132
|
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
|
}
|