HistorySearchItem extends HistoryDataItem { public String getFragment() { if (StringUtils.isBlank(searchTerm)) { return StringUtils.EMPTY; } ExecutionResult result = readSingleResult(); String snippet = extractFromResult(result); if (StringUtils.isNotBlank(snippet)) { return snippet; } return StringUtils.EMPTY; }  @Override @PostConstruct void setup(); String getFragment(); String getSelectedScript(); String getRunPath();  }
@Test public void getFragment_path_start() { item.searchTerm = "path_"; String snippet = item.getFragment(); assertEquals("<span class=\"aecu-highlight\">path_</span>text_sometextsometex...", snippet); }
@Test public void getFragment_path_end() { item.searchTerm = "_endofpath"; String snippet = item.getFragment(); assertEquals("...textsometextsometext<span class=\"aecu-highlight\">_endofpath</span>", snippet); }
@Test public void getFragment_path_middle() { item.searchTerm = "111"; String snippet = item.getFragment(); assertEquals("...ext_sometextsometext<span class=\"aecu-highlight\">111</span>sometextsometextsome...", snippet); }
@Test public void getFragment_result() { item.searchTerm = "result_"; String snippet = item.getFragment(); assertEquals("<span class=\"aecu-highlight\">result_</span>text_sometextsometex...", snippet); }
@Test public void getFragment_output() { item.searchTerm = "output_"; String snippet = item.getFragment(); assertEquals("<span class=\"aecu-highlight\">output_</span>text_sometextsometex...", snippet); }
@Test public void getFragment_fallback() { item.searchTerm = "fallback_"; String snippet = item.getFragment(); assertEquals("<span class=\"aecu-highlight\">fallback_</span>&lt;b&gt;text_sometextsome...", snippet); }
@Test public void getFragment_fallbackUpper() { item.searchTerm = "FALLBACK_"; String snippet = item.getFragment(); assertEquals("<span class=\"aecu-highlight\">fallback_</span>&lt;b&gt;text_sometextsome...", snippet); }