import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; import java.util.List; import org.junit.Test; import org.junit.Ignore; public class AnagramTest { @Test public void testNoMatches() { Anagram detector = new Anagram("diaper"); assertThat(detector.match(Arrays.asList("hello", "world", "zombies", "pants"))).isEmpty(); } @Ignore @Test public void testSimpleAnagram() { Anagram detector = new Anagram("ant"); List anagram = detector.match(Arrays.asList("tan", "stand", "at")); assertThat(anagram).containsExactly("tan"); } @Ignore @Test public void testDetectMultipleAnagrams() { Anagram detector = new Anagram("master"); List anagrams = detector.match(Arrays.asList("stream", "pigeon", "maters")); assertThat(anagrams).contains("maters", "stream"); } @Ignore @Test public void testDoesNotConfuseDifferentDuplicates() { Anagram detector = new Anagram("galea"); List anagrams = detector.match(Arrays.asList("eagle")); assertThat(anagrams).isEmpty(); } @Ignore @Test public void testIdenticalWordIsNotAnagram() { Anagram detector = new Anagram("corn"); List anagrams = detector.match(Arrays.asList("corn", "dark", "Corn", "rank", "CORN", "cron", "park")); assertThat(anagrams).containsExactly("cron"); } @Ignore @Test public void testEliminateAnagramsWithSameChecksum() { Anagram detector = new Anagram("mass"); assertThat(detector.match(Arrays.asList("last")).isEmpty()); } @Ignore @Test public void testEliminateAnagramSubsets() { Anagram detector = new Anagram("good"); assertThat(detector.match(Arrays.asList("dog", "goody"))).isEmpty(); } @Ignore @Test public void testDetectAnagrams() { Anagram detector = new Anagram("listen"); List anagrams = detector.match(Arrays.asList("enlists", "google", "inlets", "banana")); assertThat(anagrams).contains("inlets"); } @Ignore @Test public void testMultipleAnagrams() { Anagram detector = new Anagram("allergy"); List anagrams = detector.match(Arrays.asList("gallery", "ballerina", "regally", "clergy", "largely", "leading")); assertThat(anagrams).contains("gallery", "largely", "regally"); } @Ignore @Test public void testAnagramsAreCaseInsensitive() { Anagram detector = new Anagram("Orchestra"); List anagrams = detector.match(Arrays.asList("cashregister", "Carthorse", "radishes")); assertThat(anagrams).contains("Carthorse"); } }