// have & signs before tokens, > signs between them, and < signs after.
Document doc = new Document(ImmutableMap.of("text", "contains &&& signs >>>> and stuff <.", "title", "a headline!"));
indexer.add(docid, doc, (int)timestampBoost, Maps.<Integer, Double>newHashMap());
SearchResults srs = searcher.search(new Query(new AndQuery( new TermQuery("text", "signs"), new TermQuery("text", "stuff")), null, null), 0, 10, 0, ImmutableMap.of("snippet_fields", "text","snippet_type", "lines"));
SearchResult sr = srs.getResults().iterator().next();
assertNotNull("sr is null!", sr);
assertTrue("signs not highlighted!", sr.getField("snippet_text").contains("<b>signs</b>"));
assertTrue("ampersands not encoded!", sr.getField("snippet_text").contains("&"));