@Test
public void testFindAllQuotedWords() {

    LineParser lineParser = new LineParser();
    ParsedLine line = lineParser.parseLine("foo bar \"baz 12345\" ", 19);
    assertEquals("foo", line.words().get(0).word());
    assertEquals(0, line.words().get(0).lineIndex());
    assertEquals("bar", line.words().get(1).word());
    assertEquals(4, line.words().get(1).lineIndex());
    assertEquals("baz 12345", line.words().get(2).word());
    assertEquals(9, line.words().get(2).lineIndex());
    assertEquals("", line.selectedWord().word());
    assertEquals(0, line.wordCursor());
    assertFalse(line.cursorAtEnd());
    line = lineParser.parseLine("java -cp \"foo/bar\" \"Example\"", 32);
    assertEquals("foo/bar", line.words().get(2).word());
    assertEquals("Example", line.words().get(3).word());
    assertTrue(line.cursorAtEnd());
    line = lineParser.parseLine("'foo/bar/' Example\\ 1");
    assertEquals("foo/bar/", line.words().get(0).word());
    assertEquals("Example 1", line.words().get(1).word());
    line = lineParser.parseLine("man -f='foo bar/' Example\\ 1 foo");
    assertEquals("man", line.words().get(0).word());
    assertEquals("-f=foo bar/", line.words().get(1).word());
    assertEquals("Example 1", line.words().get(2).word());
    assertEquals("foo", line.words().get(3).word());
    line = lineParser.parseLine("man -f='foo/bar/ Example\\ 1");
    assertEquals(ParserStatus.UNCLOSED_QUOTE, line.status());
    line = lineParser.parseLine("man -f='foo/bar/' Example\\ 1\"");
    assertEquals(ParserStatus.UNCLOSED_QUOTE, line.status());
    line = lineParser.parseLine("-s \'redirectUris=[\"http://localhost:8080/blah/*\"]\'");
    assertEquals("-s", line.words().get(0).word());
    assertEquals("redirectUris=[\"http://localhost:8080/blah/*\"]", line.words().get(1).word());
    line = lineParser.parseLine("\"baz\\ 12345\"");
    assertEquals(line.words().toString(), "baz\\ 12345", line.words().get(0).word());
    line = lineParser.parseLine("\"\\\"String with double quotes\\\"\"");
    assertEquals(line.words().toString(), 1, line.words().size());
    assertEquals(line.words().toString(), "\\\"String with double quotes\\\"", line.words().get(0).word());
    // A word and a word containing only a double quote.
    line = lineParser.parseLine("\"\\\"String with double quotes\"\\\"");
    assertEquals(line.words().toString(), 2, line.words().size());
    assertEquals(line.words().toString(), "\\\"String with double quotes", line.words().get(0).word());
    assertEquals(line.words().toString(), "\"", line.words().get(1).word());
    line = lineParser.parseLine("'\\'String with single quotes\\''");
    assertEquals(line.words().toString(), 1, line.words().size());
    assertEquals(line.words().toString(), "\\'String with single quotes\\'", line.words().get(0).word());
    // A word and a word containing only a single quote.
    line = lineParser.parseLine("'\\'String with single quotes'\\'");
    assertEquals(line.words().toString(), 2, line.words().size());
    assertEquals(line.words().toString(), "\\'String with single quotes", line.words().get(0).word());
    assertEquals(line.words().toString(), "'", line.words().get(1).word());
}