Ver código fonte

Merge pull request #1005 from jonnynabors/master

anagram: replace Arrays.asList with Collections.singletonList #981
Stuart Kent 8 anos atrás
pai
commit
29f0d02213
Nenhuma conta conectada ao e-mail do autor de commit
1 arquivos alterados com 7 adições e 6 exclusões
  1. 7
    6
      exercises/anagram/src/test/java/AnagramTest.java

+ 7
- 6
exercises/anagram/src/test/java/AnagramTest.java Ver arquivo

2
 import org.junit.Test;
2
 import org.junit.Test;
3
 
3
 
4
 import java.util.Arrays;
4
 import java.util.Arrays;
5
+import java.util.Collections;
5
 import java.util.List;
6
 import java.util.List;
6
 
7
 
7
 import static org.hamcrest.CoreMatchers.*;
8
 import static org.hamcrest.CoreMatchers.*;
53
     @Test
54
     @Test
54
     public void testDoesNotConfuseDifferentDuplicates() {
55
     public void testDoesNotConfuseDifferentDuplicates() {
55
         Anagram detector = new Anagram("galea");
56
         Anagram detector = new Anagram("galea");
56
-        assertTrue(detector.match(Arrays.asList("eagle")).isEmpty());
57
+        assertTrue(detector.match(Collections.singletonList("eagle")).isEmpty());
57
     }
58
     }
58
 
59
 
59
     @Ignore("Remove to run test")
60
     @Ignore("Remove to run test")
69
     @Test
70
     @Test
70
     public void testIdenticalWordRepeatedIsNotAnagram() {
71
     public void testIdenticalWordRepeatedIsNotAnagram() {
71
         Anagram detector = new Anagram("go");
72
         Anagram detector = new Anagram("go");
72
-        assertTrue(detector.match(Arrays.asList("go Go GO")).isEmpty());
73
+        assertTrue(detector.match(Collections.singletonList("go Go GO")).isEmpty());
73
     }
74
     }
74
 
75
 
75
     @Ignore("Remove to run test")
76
     @Ignore("Remove to run test")
76
     @Test
77
     @Test
77
     public void testCapitalWordIsNotOwnAnagram() {
78
     public void testCapitalWordIsNotOwnAnagram() {
78
         Anagram detector = new Anagram("BANANA");
79
         Anagram detector = new Anagram("BANANA");
79
-        assertTrue(detector.match(Arrays.asList("Banana")).isEmpty());
80
+        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
80
     }
81
     }
81
 
82
 
82
     @Ignore("Remove to run test")
83
     @Ignore("Remove to run test")
83
     @Test
84
     @Test
84
     public void testEliminateAnagramsWithSameChecksum() {
85
     public void testEliminateAnagramsWithSameChecksum() {
85
         Anagram detector = new Anagram("mass");
86
         Anagram detector = new Anagram("mass");
86
-        assertTrue(detector.match(Arrays.asList("last")).isEmpty());
87
+        assertTrue(detector.match(Collections.singletonList("last")).isEmpty());
87
     }
88
     }
88
 
89
 
89
     @Ignore("Remove to run test")
90
     @Ignore("Remove to run test")
121
     @Test
122
     @Test
122
     public void testWordIsNotItsOwnAnagram() {
123
     public void testWordIsNotItsOwnAnagram() {
123
         Anagram detector = new Anagram("banana");
124
         Anagram detector = new Anagram("banana");
124
-        assertTrue(detector.match(Arrays.asList("Banana")).isEmpty());
125
+        assertTrue(detector.match(Collections.singletonList("Banana")).isEmpty());
125
     }
126
     }
126
 
127
 
127
     @Ignore("Remove to run test")
128
     @Ignore("Remove to run test")
128
     @Test
129
     @Test
129
     public void testAnagramMustUseAllLettersExactlyOnce() {
130
     public void testAnagramMustUseAllLettersExactlyOnce() {
130
         Anagram detector = new Anagram("tapper");
131
         Anagram detector = new Anagram("tapper");
131
-        assertTrue(detector.match(Arrays.asList("patter")).isEmpty());
132
+        assertTrue(detector.match(Collections.singletonList("patter")).isEmpty());
132
     }
133
     }
133
 }
134
 }