11import org .junit .jupiter .api .Disabled ;
2+ import org .junit .jupiter .api .DisplayName ;
23import org .junit .jupiter .api .Test ;
34
45import java .util .Arrays ;
910public class AnagramTest {
1011
1112 @ Test
13+ @ DisplayName ("no matches" )
1214 public void testNoMatches () {
1315 Anagram detector = new Anagram ("diaper" );
1416
@@ -20,6 +22,7 @@ public void testNoMatches() {
2022
2123 @ Disabled ("Remove to run test" )
2224 @ Test
25+ @ DisplayName ("detects two anagrams" )
2326 public void testDetectsTwoAnagrams () {
2427 Anagram detector = new Anagram ("solemn" );
2528
@@ -29,6 +32,7 @@ public void testDetectsTwoAnagrams() {
2932
3033 @ Disabled ("Remove to run test" )
3134 @ Test
35+ @ DisplayName ("does not detect anagram subsets" )
3236 public void testEliminateAnagramSubsets () {
3337 Anagram detector = new Anagram ("good" );
3438
@@ -37,6 +41,7 @@ public void testEliminateAnagramSubsets() {
3741
3842 @ Disabled ("Remove to run test" )
3943 @ Test
44+ @ DisplayName ("detects anagram" )
4045 public void testDetectLongerAnagram () {
4146 Anagram detector = new Anagram ("listen" );
4247
@@ -48,6 +53,7 @@ public void testDetectLongerAnagram() {
4853
4954 @ Disabled ("Remove to run test" )
5055 @ Test
56+ @ DisplayName ("detects three anagrams" )
5157 public void testDetectMultipleAnagramsForLongerWord () {
5258 Anagram detector = new Anagram ("allergy" );
5359 assertThat (
@@ -64,6 +70,7 @@ public void testDetectMultipleAnagramsForLongerWord() {
6470
6571 @ Disabled ("Remove to run test" )
6672 @ Test
73+ @ DisplayName ("detects multiple anagrams with different case" )
6774 public void testDetectsMultipleAnagramsWithDifferentCase () {
6875 Anagram detector = new Anagram ("nose" );
6976
@@ -73,6 +80,7 @@ public void testDetectsMultipleAnagramsWithDifferentCase() {
7380
7481 @ Disabled ("Remove to run test" )
7582 @ Test
83+ @ DisplayName ("does not detect non-anagrams with identical checksum" )
7684 public void testEliminateAnagramsWithSameChecksum () {
7785 Anagram detector = new Anagram ("mass" );
7886
@@ -82,6 +90,7 @@ public void testEliminateAnagramsWithSameChecksum() {
8290
8391 @ Disabled ("Remove to run test" )
8492 @ Test
93+ @ DisplayName ("detects anagrams case-insensitively" )
8594 public void testCaseInsensitiveWhenBothAnagramAndSubjectStartWithUpperCaseLetter () {
8695 Anagram detector = new Anagram ("Orchestra" );
8796
@@ -93,6 +102,7 @@ public void testCaseInsensitiveWhenBothAnagramAndSubjectStartWithUpperCaseLetter
93102
94103 @ Disabled ("Remove to run test" )
95104 @ Test
105+ @ DisplayName ("detects anagrams using case-insensitive subject" )
96106 public void testCaseInsensitiveWhenSubjectStartsWithUpperCaseLetter () {
97107 Anagram detector = new Anagram ("Orchestra" );
98108
@@ -104,6 +114,7 @@ public void testCaseInsensitiveWhenSubjectStartsWithUpperCaseLetter() {
104114
105115 @ Disabled ("Remove to run test" )
106116 @ Test
117+ @ DisplayName ("detects anagrams using case-insensitive possible matches" )
107118 public void testCaseInsensitiveWhenAnagramStartsWithUpperCaseLetter () {
108119 Anagram detector = new Anagram ("orchestra" );
109120
@@ -115,6 +126,7 @@ public void testCaseInsensitiveWhenAnagramStartsWithUpperCaseLetter() {
115126
116127 @ Disabled ("Remove to run test" )
117128 @ Test
129+ @ DisplayName ("does not detect an anagram if the original word is repeated" )
118130 public void testIdenticalWordRepeatedIsNotAnagram () {
119131 Anagram detector = new Anagram ("go" );
120132
@@ -124,6 +136,7 @@ public void testIdenticalWordRepeatedIsNotAnagram() {
124136
125137 @ Disabled ("Remove to run test" )
126138 @ Test
139+ @ DisplayName ("anagrams must use all letters exactly once" )
127140 public void testAnagramMustUseAllLettersExactlyOnce () {
128141 Anagram detector = new Anagram ("tapper" );
129142
@@ -133,6 +146,7 @@ public void testAnagramMustUseAllLettersExactlyOnce() {
133146
134147 @ Disabled ("Remove to run test" )
135148 @ Test
149+ @ DisplayName ("words are not anagrams of themselves" )
136150 public void testWordsAreNotAnagramsOfThemselvesCaseInsensitive () {
137151 Anagram detector = new Anagram ("BANANA" );
138152
@@ -142,6 +156,7 @@ public void testWordsAreNotAnagramsOfThemselvesCaseInsensitive() {
142156
143157 @ Disabled ("Remove to run test" )
144158 @ Test
159+ @ DisplayName ("words are not anagrams of themselves even if letter case is partially different" )
145160 public void testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsPartiallyDifferent () {
146161 Anagram detector = new Anagram ("BANANA" );
147162
@@ -151,6 +166,7 @@ public void testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsPartiallyDiffer
151166
152167 @ Disabled ("Remove to run test" )
153168 @ Test
169+ @ DisplayName ("words are not anagrams of themselves even if letter case is completely different" )
154170 public void testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsCompletelyDifferent () {
155171 Anagram detector = new Anagram ("BANANA" );
156172
@@ -160,6 +176,7 @@ public void testWordsAreNotAnagramsOfThemselvesEvenIfLetterCaseIsCompletelyDiffe
160176
161177 @ Disabled ("Remove to run test" )
162178 @ Test
179+ @ DisplayName ("words other than themselves can be anagrams" )
163180 public void testWordsOtherThanThemselvesCanBeAnagrams () {
164181 Anagram detector = new Anagram ("LISTEN" );
165182
@@ -169,6 +186,7 @@ public void testWordsOtherThanThemselvesCanBeAnagrams() {
169186
170187 @ Disabled ("Remove to run test" )
171188 @ Test
189+ @ DisplayName ("handles case of greek letters" )
172190 public void testHandlesCaseOfGreekLetters () {
173191 Anagram detector = new Anagram ("ΑΒΓ" );
174192
@@ -178,6 +196,7 @@ public void testHandlesCaseOfGreekLetters() {
178196
179197 @ Disabled ("Remove to run test" )
180198 @ Test
199+ @ DisplayName ("different characters may have the same bytes" )
181200 public void testDifferentCharactersWithSameBytes () {
182201 Anagram detector = new Anagram ("a⬂" );
183202
0 commit comments