void () { myFixture.addClass(""" package com.sample; /** * Created with IntelliJ IDEA. * User: jetbrains * Date: 11/26/12 * Time: 6:08 PM * @noinspection ALL */ public class RunningMain { public static void main(String[] args) throws Exception { try { func1(); } finally { } } static void func1() { try { func(); } finally { } } static void func() { throw new NullPointerException(); } } """); final String testData = """ Exception in thread "main" java.lang.NullPointerException \tat com.sample.RunningMain.func(RunningMain.java:30) \tat com.sample.RunningMain.func1(RunningMain.java:22) \tat com.sample.RunningMain.main(RunningMain.java:13) """; final Document document = EditorFactory.getInstance().createDocument(testData); FilterMixin filter = (FilterMixin)new ExceptionExFilterFactory().create(GlobalSearchScope.projectScope(getProject())); final ArrayList<String> result = new ArrayList<>(); filter.applyHeavyFilter(document, 0, 0, r -> r.getResultItems().forEach( highlight -> result.add(new TextRange(highlight.getHighlightStartOffset(), highlight.getHighlightEndOffset()).substring(testData)))); assertSameElements(result, "com.sample.RunningMain.func1", "com.sample.RunningMain.main"); }