SimpleKeywordTokenizer implements KeywordTokenizer { @Override public boolean requiresTokenization(String keyword) { int start = keyword.indexOf(CharPool.QUOTE); int end = keyword.indexOf(CharPool.QUOTE, start + 1); if (!((keyword.indexOf(CharPool.QUOTE) == 0) && (keyword.lastIndexOf(CharPool.QUOTE) == (keyword.length() - 1))) && (((start > -1) && (end > start)) || ((start == -1) && (end == -1) && (keyword.indexOf(CharPool.SPACE) != -1)))) { return true; } return false; }  @Override boolean requiresTokenization(String keyword); @Override List<String> tokenize(String keyword);  }
@Test public void testRequiresTokenization() { Assert.assertTrue(requiresTokenization("This is a simple test")); Assert.assertTrue(requiresTokenization("This \"is a simple\" test")); Assert.assertFalse(requiresTokenization("\"is a simple\"")); }