| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package com.zipcodewilmington;
-
- import org.junit.Assert;
- import org.junit.Test;
-
- /**
- * Created by leon on 1/29/18.
- */
- public class StringArrayUtilsTest {
- private static final String[] testArray = {"the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
-
- @Test
- public void testContains() {
- for (String s : testArray) {
- boolean outcome = StringArrayUtils.contains(testArray, s);
- Assert.assertTrue(outcome);
- }
- }
-
- @Test
- public void testRemoveValue() {
- String[] expected = {"quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
- String[] actual = StringArrayUtils.removeValue(expected, "The");
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testRemoveValue1() {
- String[] expected = {"the", "brown", "fox", "jumps", "over", "the", "lazy", "dog"};
- String[] actual = StringArrayUtils.removeValue(expected, "quick");
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testRemoveValue2() {
- String[] expected = {"the", "quick", "fox", "jumps", "over", "the", "lazy", "dog"};
- String[] actual = StringArrayUtils.removeValue(expected, "brown");
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetNumberOfOccurrences1() {
- int expected = 2;
- int actual = StringArrayUtils.getNumberOfOccurrences(testArray, "the");
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testGetNumberOfOccurrences2() {
- int expected = 1;
- int actual = StringArrayUtils.getNumberOfOccurrences(testArray, "quick");
- Assert.assertEquals(expected, actual);
- }
- }
|