void (boolean childrenFirst) { configureFromFileText("C.java", "class C { int answer = 42; }"); StringBuilder result = new StringBuilder(); Iterator<PsiElement> descendants = PsiTreeUtilKt.descendants(getFile(), childrenFirst, __ -> true).iterator(); while (descendants.hasNext()) { PsiElement next = descendants.next(); result.append(next.getTextRange()).append(" ").append(next.getNode().getElementType()).append("\n"); } EqualsToFile.assertEqualsToFile( "PSI traversal", new File(JavaTestUtil.getJavaTestDataPath() + "/util/psiTree/" + getTestName(true) + ".txt"), result.toString() ); }