Leon 6 lat temu
rodzic
commit
c38f54031e

+ 16
- 10
src/test/java/com/zipcodewilmington/StringArrayUtilsTest.java Wyświetl plik

233
 
233
 
234
     @Test
234
     @Test
235
     public void testIsPalindromic2() {
235
     public void testIsPalindromic2() {
236
-        String[] array = {"Is this a plaindrome?", "This is a plaindrome", "Is this a palindrome?"};
236
+        String[] array = {"Is this a palindrome?", "This is a palindrome", "Is this a palindrome?"};
237
         boolean outcome = StringArrayUtils.isPalindromic(array);
237
         boolean outcome = StringArrayUtils.isPalindromic(array);
238
         Assert.assertTrue(outcome);
238
         Assert.assertTrue(outcome);
239
     }
239
     }
243
     public void testIsPalindromic3() {
243
     public void testIsPalindromic3() {
244
         String[] array = {"Is this a plaindrome?", "This is not a plaindrome", "Is this a palindrome?", "This is not a palindrome"};
244
         String[] array = {"Is this a plaindrome?", "This is not a plaindrome", "Is this a palindrome?", "This is not a palindrome"};
245
         boolean outcome = StringArrayUtils.isPalindromic(array);
245
         boolean outcome = StringArrayUtils.isPalindromic(array);
246
-        Assert.assertTrue(outcome);
246
+        Assert.assertFalse(outcome);
247
     }
247
     }
248
 
248
 
249
 
249
 
276
     }
276
     }
277
 
277
 
278
 
278
 
279
+    @Test
280
+    public void testIsPangramic4() {
281
+        String[] array = {"a", "b", "c", "d"};
282
+        boolean outcome = StringArrayUtils.isPangramic(array);
283
+        Assert.assertFalse(outcome);
284
+    }
285
+
286
+
279
 
287
 
280
 
288
 
281
 
289
 
343
     }
351
     }
344
 
352
 
345
 
353
 
346
-
347
     @Test
354
     @Test
348
     public void testRemoveConsecutiveDuplicates3() {
355
     public void testRemoveConsecutiveDuplicates3() {
349
-        String[] array = {"aba", "aba", "baa", "bab", "bba", "zzz", "bba", "bba", "bba", "bbb", "bbb", "aba", "bbb"};
356
+        String[] array = {"aba", "aba", "baa", "bab", "bba", "zzz", "bba", "bba", "bba", "aba", "bbb"};
350
         String[] actual = StringArrayUtils.removeConsecutiveDuplicates(array);
357
         String[] actual = StringArrayUtils.removeConsecutiveDuplicates(array);
351
         String[] expected = {"aba", "baa", "bab", "bba", "zzz", "bba", "aba", "bbb"};
358
         String[] expected = {"aba", "baa", "bab", "bba", "zzz", "bba", "aba", "bbb"};
352
         Assert.assertEquals(actual, expected);
359
         Assert.assertEquals(actual, expected);
364
 
371
 
365
     @Test
372
     @Test
366
     public void testRemovePackDuplicates1() {
373
     public void testRemovePackDuplicates1() {
367
-        String[] array = {"a", "a", "a", "a", "b", "c", "c", "a", "a", "d"};
368
-        String[] expected = {"aaa", "b", "cc", "aa", "d", "eee"};
374
+        String[] array = {"a", "a", "a", "b", "c", "c", "a", "a", "d"};
375
+        String[] expected = {"aaa", "b", "cc", "aa", "d"};
369
         String[] actual = StringArrayUtils.packConsecutiveDuplicates(array);
376
         String[] actual = StringArrayUtils.packConsecutiveDuplicates(array);
370
         Assert.assertEquals(expected, actual);
377
         Assert.assertEquals(expected, actual);
371
     }
378
     }
372
 
379
 
373
 
380
 
374
-
375
     @Test
381
     @Test
376
     public void testRemovePackDuplicates2() {
382
     public void testRemovePackDuplicates2() {
377
         String[] array = {"t", "t", "q", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e"};
383
         String[] array = {"t", "t", "q", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e"};
378
-        String[] expected = {"tt", "q", "aaa", "cc", "aa", "d", "eee"};
384
+        String[] expected = {"tt", "q", "aaa", "b", "cc", "aa", "d", "eee"};
379
         String[] actual = StringArrayUtils.packConsecutiveDuplicates(array);
385
         String[] actual = StringArrayUtils.packConsecutiveDuplicates(array);
380
         Assert.assertEquals(expected, actual);
386
         Assert.assertEquals(expected, actual);
381
     }
387
     }
399
 
405
 
400
     @Test
406
     @Test
401
     public void testRemoveValue() {
407
     public void testRemoveValue() {
402
-        String[] array = {"the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
408
+        String[] array = {"The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
403
         String[] expected = {"quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
409
         String[] expected = {"quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
404
         String[] actual = StringArrayUtils.removeValue(array, "The");
410
         String[] actual = StringArrayUtils.removeValue(array, "The");
405
         Assert.assertEquals(expected, actual);
411
         Assert.assertEquals(expected, actual);
432
 
438
 
433
 
439
 
434
 
440
 
435
-}
441
+}