@Test @ConditionalRun(RepositoryInstalled.MercurialInstalled.class) public void testGetContext_4args() throws Exception { String path = "/mercurial/Makefile"; File file = new File(repositories.getSourceRoot() + path); String parent = file.getParent(); String base = file.getName(); TermQuery q1 = new TermQuery(new Term("hist", "dummy")); StringWriter sw = new StringWriter(); assertTrue(new HistoryContext(q1).getContext(parent, base, path, sw, null)); assertTrue(sw.toString().contains( "Created a small <b>dummy</b> program")); PhraseQuery.Builder q2 = new PhraseQuery.Builder(); q2.add(new Term("hist", "dummy")); q2.add(new Term("hist", "program")); sw = new StringWriter(); assertTrue(new HistoryContext(q2.build()).getContext(parent, base, path, sw, null)); assertTrue(sw.toString().contains( "Created a small <b>dummy program</b>")); TermQuery q3 = new TermQuery(new Term("hist", "term_does_not_exist")); sw = new StringWriter(); assertFalse(new HistoryContext(q3).getContext(parent, base, path, sw, null)); assertEquals("", sw.toString()); BooleanQuery.Builder q4 = new BooleanQuery.Builder(); q4.add(new TermQuery(new Term("hist", "small")), Occur.SHOULD); q4.add(new TermQuery(new Term("hist", "target")), Occur.SHOULD); sw = new StringWriter(); assertTrue(new HistoryContext(q4.build()).getContext(parent, base, path, sw, null)); String result = sw.toString(); assertTrue(result.contains( "Add lint make <b>target</b> and fix lint warnings")); assertTrue(result.contains( "Created a <b>small</b> dummy program")); }
public boolean getContext(String filename, String path, List<Hit> hits) throws HistoryException { if (m == null) { return false; } File f = new File(filename); return getHistoryContext(HistoryGuru.getInstance().getHistory(f), path, null, hits, null); }
HistoryContext { public boolean getContext(String filename, String path, List<Hit> hits) throws HistoryException { if (m == null) { return false; } File f = new File(filename); return getHistoryContext(HistoryGuru.getInstance().getHistory(f), path, null, hits, null); } }
HistoryContext { public boolean getContext(String filename, String path, List<Hit> hits) throws HistoryException { if (m == null) { return false; } File f = new File(filename); return getHistoryContext(HistoryGuru.getInstance().getHistory(f), path, null, hits, null); } HistoryContext(Query query); }
HistoryContext { public boolean getContext(String filename, String path, List<Hit> hits) throws HistoryException { if (m == null) { return false; } File f = new File(filename); return getHistoryContext(HistoryGuru.getInstance().getHistory(f), path, null, hits, null); } HistoryContext(Query query); boolean isEmpty(); boolean getContext(String filename, String path, List<Hit> hits); boolean getContext(String parent, String basename, String path, Writer out, String context); boolean getContext(File src, String path, Writer out, String context); }
HistoryContext { public boolean getContext(String filename, String path, List<Hit> hits) throws HistoryException { if (m == null) { return false; } File f = new File(filename); return getHistoryContext(HistoryGuru.getInstance().getHistory(f), path, null, hits, null); } HistoryContext(Query query); boolean isEmpty(); boolean getContext(String filename, String path, List<Hit> hits); boolean getContext(String parent, String basename, String path, Writer out, String context); boolean getContext(File src, String path, Writer out, String context);  }