@Test
public void testStringToJCRSearchExp() {

    String term = "foo bar";
    assertEquals(getFinalTerm(term), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo -bar";
    assertEquals(getFinalTerm(term), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \\-bar";
    assertEquals(getFinalTerm(term), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \"bar";
    assertEquals(getFinalTerm("foo \\\"bar"), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \"bar baz\"";
    assertEquals(getFinalTerm(term), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \"bar -baz\"";
    assertEquals(getFinalTerm(term), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \"bar baz\"   boo\"";
    assertEquals(getFinalTerm("foo \"bar baz\"   boo\\\""), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo \"bar baz\" \"fu boo\"";
    assertEquals(getFinalTerm("foo \"bar baz\" \"fu boo\""), JCRContentUtils.stringToJCRSearchExp(term));
    term = "    foo \"bar baz\"   boo    bu  ";
    assertEquals(getFinalTerm("foo \"bar baz\"   boo    bu"), JCRContentUtils.stringToJCRSearchExp(term));
    term = "\"foo";
    assertEquals(getFinalTerm("\\\"foo"), JCRContentUtils.stringToJCRSearchExp(term));
    term = "foo\"";
    assertEquals(getFinalTerm("foo\\\""), JCRContentUtils.stringToJCRSearchExp(term));
    term = "\"";
    assertEquals(getFinalTerm("\\\""), JCRContentUtils.stringToJCRSearchExp(term));
    term = "";
    assertEquals(getFinalTerm(""), JCRContentUtils.stringToJCRSearchExp(term));
}