void () { ApplicationManager.getApplication().runWriteAction(() -> { configureFromFileText("Main.java", """ import java.util.stream.Stream; public class Main { public static void main(String[] args) { <caret>Stream.of(1,2,3).map(x -> x * x ).filter(x -> x % 2 == 1).toArray(); } } """, true); final PsiFile file = getFile(); final int offset = getEditor().getCaretModel().getCurrentCaret().getOffset(); final PsiElement elementAtCaret = DebuggerUtilsEx.findElementAt(file, offset); PackageChainDetector chainDetector = PackageChainDetector.Companion.forJavaStreams("java.util.stream"); final JavaStreamChainBuilder builder = new JavaStreamChainBuilder(new JavaChainTransformerImpl(), chainDetector); final List<StreamChain> chains = builder.build(elementAtCaret); assertEquals(1, chains.size()); DslImpl javaDsl = new DslImpl(new JavaStatementFactory()); StandardLibrarySupport librarySupport = new StandardLibrarySupport(); final JavaTraceExpressionBuilder expressionBuilder = new JavaTraceExpressionBuilder(getProject(), librarySupport .createHandlerFactory(javaDsl), javaDsl); expressionBuilder.createTraceExpression(chains.get(0)); }); }