ExpressionTokenizer { protected boolean isQuoted(String str, int pos) { int start = str.indexOf("\""); if(start < 0 || pos < start) { return false; } int end = str.indexOf("\"", start + 1); if(end < 0) { return false; } if(pos <= end) { return true; } return isQuoted(str.substring(end + 1), pos-end-1); } ExpressionTokenizer(String arg); List<String> getCommandStrings();  }
@Test public void testQuoted1() { String str = "01234\"678\"0"; ExpressionTokenizer t = new ExpressionTokenizer(str); assertFalse(t.isQuoted(str, 0)); assertFalse(t.isQuoted(str, 1)); assertFalse(t.isQuoted(str, 4)); assertTrue(t.isQuoted(str, 5)); assertTrue(t.isQuoted(str, 6)); assertTrue(t.isQuoted(str, 7)); assertTrue(t.isQuoted(str, 8)); assertTrue(t.isQuoted(str, 9)); assertFalse(t.isQuoted(str, 10)); }
@Test public void testQuoted2() { String str = "01234\"678\"0"; ExpressionTokenizer t = new ExpressionTokenizer(str); assertFalse(t.isQuoted(str, 11)); assertFalse(t.isQuoted(str, 15)); }
@Test public void testQuoted3() { String str = "01234\"67890"; ExpressionTokenizer t = new ExpressionTokenizer(str); assertFalse(t.isQuoted(str, 11)); assertFalse(t.isQuoted(str, 15)); }
@Test public void testQuoted4() { String str = "01234\"678\"01\""; ExpressionTokenizer t = new ExpressionTokenizer(str); assertTrue(t.isQuoted(str, 6)); assertTrue(t.isQuoted(str, 7)); assertTrue(t.isQuoted(str, 8)); assertTrue(t.isQuoted(str, 9)); assertFalse(t.isQuoted(str, 10)); assertFalse(t.isQuoted(str, 11)); assertFalse(t.isQuoted(str, 12)); assertFalse(t.isQuoted(str, 13)); assertFalse(t.isQuoted(str, 14)); }