@Test
public void testReadUrlEntries() throws IOException {
JTweet tw = new JTweet(1L, "text", new JUser("peter"));
List<UrlEntry> entries = new ArrayList<UrlEntry>();
UrlEntry urlEntry = new UrlEntry(2, 18, "http://fulltest.de/bla");
urlEntry.setResolvedDomain("resolved-domain.de");
urlEntry.setResolvedTitle("ResolvedTitel");
entries.add(urlEntry);
tw.setUrlEntries(entries);
XContentBuilder iDoc = twSearch.createDoc(tw);
String str = iDoc.prettyPrint().string();
assertTrue(str.contains("\"url_pos_1_s\":\"2,18\""));
assertTrue(str.contains("\"dest_url_1_s\":\"http://fulltest.de/bla\""));
assertTrue(str.contains("\"dest_domain_1_s\":\"resolved-domain.de\""));
assertTrue(str.contains("\"dest_title_1_s\":\"ResolvedTitel\""));
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("user", "peter");
map.put("tw", "text");
map.put("url_i", 1);
map.put("retw_i", 0);
map.put("repl_i", 0);
map.put("url_pos_1_s", "2,18");
map.put("dest_url_1_s", "http://fulltest.de/bla");
map.put("dest_domain_1_s", "resolved-domain.de");
map.put("dest_title_1_s", "ResolvedTitel");
JTweet tw2 = twSearch.readDoc("1", 0L, map);
assertEquals(1, tw2.getUrlEntries().size());
Iterator<UrlEntry> iter = tw2.getUrlEntries().iterator();
urlEntry = iter.next();
assertEquals("http://fulltest.de/bla", urlEntry.getResolvedUrl());
assertEquals("resolved-domain.de", urlEntry.getResolvedDomain());
assertEquals("ResolvedTitel", urlEntry.getResolvedTitle());
assertEquals(2, urlEntry.getIndex());
assertEquals(18, urlEntry.getLastIndex());
}