### Question:
TextUtil { public static String[] tokenizeStringWithQuotes( String string ) { return tokenizeStringWithQuotes( string, true, false ); } private  TextUtil(); static String templateString( String templateString,
            Map<String, ?> data ); static String templateString( String templateString,
            String variablePrefix, Map<String, ?> data ); static String lastWordOrQuoteOf( String text, boolean preserveQuotation ); static String[] tokenizeStringWithQuotes( String string ); static String[] tokenizeStringWithQuotes( String string, boolean trim, boolean preserveEscapeCharacters ); static String[] tokenizeStringWithQuotes( String string, boolean trim, boolean preserveEscapeCharacters, boolean preserveSpaceEscapeCharacters );  }### Answer:
@Test void shouldTokenizeStringWithWithoutQuotes() { String untokenized = "First Second Third"; String[] tokenized = TextUtil.tokenizeStringWithQuotes( untokenized ); assertArrayEquals( new String[] {"First", "Second", "Third"}, tokenized ); }
@Test void shouldTokenizeStringWithQuotes() { String untokenized = "First \"Second one\" Third \"And a fourth\""; String[] tokenized = TextUtil.tokenizeStringWithQuotes( untokenized ); assertArrayEquals( new String[] {"First", "Second one", "Third", "And a fourth"}, tokenized ); }
@Test void shouldTokenStringWithWithQuotesAndEscapedSpaces() { String untokenized = "First \"Second one\" Third And\\ a\\ fourth"; String[] tokenized = TextUtil.tokenizeStringWithQuotes( untokenized ); assertArrayEquals( new String[] {"First", "Second one", "Third", "And a fourth"}, tokenized ); }
@Test void shouldPreserveBackslashes() { String untokenized = "First C:\\a\\b\\c"; String[] tokenized = TextUtil.tokenizeStringWithQuotes( untokenized, true, true ); assertArrayEquals( new String[] {"First", "C:\\a\\b\\c"}, tokenized ); }
@Test void preserveOnlyPathBackslashes() { String untokenized = "First C:\\a\\ r\\b\\c"; String[] tokenized = TextUtil.tokenizeStringWithQuotes( untokenized, true, true, false ); assertArrayEquals( new String[] {"First", "C:\\a r\\b\\c"}, tokenized ); }