@@ -18,30 +18,8 @@ void testFindTopKFrequentWords(String[] words, int k, List<String> expected) {
1818 }
1919
2020 static Stream <Arguments > validTestCases () {
21- return Stream .of (
22- Arguments .of (
23- new String [] {"i" , "love" , "leetcode" , "i" , "love" , "coding" },
24- 2 ,
25- List .of ("i" , "love" )
26- ),
27- Arguments .of (
28- new String [] {"the" , "day" , "is" , "sunny" , "the" , "the" , "the" , "sunny" , "is" , "is" },
29- 4 ,
30- List .of ("the" , "is" , "sunny" , "day" )
31- ),
32- Arguments .of (
33- new String [] {"bbb" , "aaa" , "bbb" , "aaa" , "ccc" },
34- 2 ,
35- List .of ("aaa" , "bbb" )
36- ),
37- Arguments .of (
38- new String [] {"one" , "two" , "three" },
39- 10 ,
40- List .of ("one" , "three" , "two" )
41- ),
42- Arguments .of (new String [] {}, 3 , List .of ()),
43- Arguments .of (new String [] {"x" , "x" , "y" }, 0 , List .of ())
44- );
21+ return Stream .of (Arguments .of (new String [] {"i" , "love" , "leetcode" , "i" , "love" , "coding" }, 2 , List .of ("i" , "love" )), Arguments .of (new String [] {"the" , "day" , "is" , "sunny" , "the" , "the" , "the" , "sunny" , "is" , "is" }, 4 , List .of ("the" , "is" , "sunny" , "day" )),
22+ Arguments .of (new String [] {"bbb" , "aaa" , "bbb" , "aaa" , "ccc" }, 2 , List .of ("aaa" , "bbb" )), Arguments .of (new String [] {"one" , "two" , "three" }, 10 , List .of ("one" , "three" , "two" )), Arguments .of (new String [] {}, 3 , List .of ()), Arguments .of (new String [] {"x" , "x" , "y" }, 0 , List .of ()));
4523 }
4624
4725 @ ParameterizedTest
@@ -51,10 +29,6 @@ void testFindTopKFrequentWordsInvalidInput(String[] words, int k) {
5129 }
5230
5331 static Stream <Arguments > invalidTestCases () {
54- return Stream .of (
55- Arguments .of ((String []) null , 1 ),
56- Arguments .of (new String [] {"a" , null , "b" }, 2 ),
57- Arguments .of (new String [] {"a" }, -1 )
58- );
32+ return Stream .of (Arguments .of ((String []) null , 1 ), Arguments .of (new String [] {"a" , null , "b" }, 2 ), Arguments .of (new String [] {"a" }, -1 ));
5933 }
6034}
0 commit comments