@Test(timeout = 500L) public void testFindAllAnagramsByNonExistentDictionaryWord() throws InvalidWordException { Set<String> anagrams = classUnderTest.findAllAnagramsForTheWord("nonExistentWord"); assertEquals(0, anagrams.size()); logger.info( "Searching for anagrams of 'nonExistentWord' returned " + anagrams.size() + " results."); }
@Test(timeout = 500L) public void testFindAllAnagramsByDictionaryWord() throws InvalidWordException { Set<String> anagrams = classUnderTest.findAllAnagramsForTheWord("leaps"); assertEquals(6, anagrams.size()); assertTrue( anagrams.containsAll( Arrays.asList(new String[] {"lapse", "leaps", "pales", "peals", "pleas", "sepal"}))); logger.info("Searching for anagrams of 'leaps' returned: " + anagrams); }