### Question:
CsvRowIterator extends RawRowIterator { public static List<String> splitLine(String line) { Objects.requireNonNull(line); List<String> list = new ArrayList<>(); StringBuilder sb = new StringBuilder(); boolean insideQuotes = false; for (char c : line.toCharArray()) { switch (c) { case SEPARATOR: if (insideQuotes) { sb.append(c); } else { list.add(sb.toString()); sb.setLength(0); } break; case QUOTES: insideQuotes = !insideQuotes; break; default: sb.append(c); break; } } if (insideQuotes) { sb.insert(0, QUOTES); } list.add(sb.toString()); return list; } CsvRowIterator(InputStream inputStream); @Override synchronized Map<Integer, String> readNextRow(); static List<String> splitLine(String line); @Override synchronized void close();  }### Answer:
@Test(expected = NullPointerException.class) public void testSplitLineNullShouldThrowException() { CsvRowIterator.splitLine(null); }
@Test public void testSplitLineEmptyStringShouldReturnEmptyList() { assertEquals(Arrays.asList(""), CsvRowIterator.splitLine("")); }
@Test public void testSplitLineSingleCommaShouldReturnTwoEmptyEntries() { assertEquals(Arrays.asList("", ""), CsvRowIterator.splitLine(",")); }
@Test public void testSplitLineTwoCommasShouldReturnThreeEmptyEntries() { assertEquals(Arrays.asList("", "", ""), CsvRowIterator.splitLine(",,")); }
@Test public void testSplitLineOneItemShouldReturnOneItem() { assertEquals(Arrays.asList("Hello"), CsvRowIterator.splitLine("Hello")); }
@Test public void testSplitLineTwoItemsShouldReturnTwoItems() { assertEquals(Arrays.asList("Hello", "World"), CsvRowIterator.splitLine("Hello,World")); }
@Test public void testSplitLineThreeItemsShouldReturnThreeItems() { assertEquals(Arrays.asList("Hello", "World", "!"), CsvRowIterator.splitLine("Hello,World,!")); }
@Test public void testSplitLineTwoItemsWithSpacesShouldReturnTwoItemsWithSpaces() { assertEquals( Arrays.asList(" Hello ", " World "), CsvRowIterator.splitLine(" Hello , World ")); }
@Test public void testSplitLineTwoItemsUsingQuotesShouldReturnTwoItemsAndNoQuotes() { assertEquals(Arrays.asList("Hello", "World,!"), CsvRowIterator.splitLine("Hello,\"World,!\"")); }
@Test public void testSplitLineOneItemUsingQuotesShouldReturnOneItemAndNoQuotes() { assertEquals(Arrays.asList("Hello,World,!"), CsvRowIterator.splitLine("\"Hello,World,!\"")); }
@Test public void testSplitLineQuotesAloneShouldReturnQuotesAlone() { assertEquals(Arrays.asList("\""), CsvRowIterator.splitLine("\"")); }
@Test public void testSplitLineOpeningQuotesWithoutClosingThemShouldReturnStringWithQuotesAtTheStart() { assertEquals(Arrays.asList("Hello", "\"World"), CsvRowIterator.splitLine("Hello,\"World")); }
@Test public void testSplitLineOpeningAndClosingQuotesShouldReturnEmptyString() { assertEquals(Arrays.asList(""), CsvRowIterator.splitLine("\"\"")); }