Anagrams { public List<String> get(String input) { List<String> result = null; if (input == null) { throw new IllegalArgumentException("You can't pass a null String as input."); } else if (input.isEmpty()) { result = new LinkedList<String>(); } else { result = getAnagramsInner("", input); } return result; }  List<String> get(String input);  }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullStrings() { anagrams.get(null); }
@Test public void shouldReturnAnEmptyListIfInputStringIsEmpty() { assertTrue(anagrams.get("").isEmpty()); }
@Test public void shouldCalculateEveryAnagram() { String input = "abc"; List<String> result = anagrams.get(input); String[] arrayResult = new String[result.size()]; result.toArray(arrayResult); String[] expectedArray = { "abc", "acb", "bac", "bca", "cab", "cba" }; assertArrayEquals(expectedArray, arrayResult); }