Sfoglia il codice sorgente

anagram: Clarify expectations about identical words

An anagram is defined as

1. the same letters
2. rearranged
3. to make a new word

The existing assertion only checked the presence of the expected word,
but did not explicitly exclude the existence of results that match the
input exactly.
John Michael Luy 11 anni fa
parent
commit
a4c9c26d5f
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1
    1
      anagram/src/test/java/AnagramTest.java

+ 1
- 1
anagram/src/test/java/AnagramTest.java Vedi File

38
     public void testIdenticalWordIsNotAnagram() {
38
     public void testIdenticalWordIsNotAnagram() {
39
         Anagram detector = new Anagram("corn");
39
         Anagram detector = new Anagram("corn");
40
         List<String> anagrams = detector.match(Arrays.asList("corn", "dark", "Corn", "rank", "CORN", "cron", "park"));
40
         List<String> anagrams = detector.match(Arrays.asList("corn", "dark", "Corn", "rank", "CORN", "cron", "park"));
41
-        assertThat(anagrams, hasItems("cron"));
41
+        assertEquals(anagrams, Arrays.asList("cron"));
42
     }
42
     }
43
 
43
 
44
     @Test
44
     @Test