@Test public void testClassWithoutBody() { Tree tree = kotlin("class A {}"); assertTree(tree).isInstanceOf(ClassDeclarationTree.class); ClassDeclarationTree classA = (ClassDeclarationTree) tree; assertTree(classA.identifier()).isIdentifier("A"); assertThat(classA.descendants().anyMatch(IdentifierTree.class::isInstance)).isTrue(); assertRange(classA.identifier().textRange()).hasRange(1, 6, 1, 7); assertTree(tree).isEquivalentTo(kotlin("class A {}")); assertTree(tree).isNotEquivalentTo(kotlin("class A constructor(){}")); assertTree(tree).isNotEquivalentTo(kotlin("class B {}")); }
private static Stream<PsiElement> descendants(PsiElement element) { return Arrays.stream(element.getChildren()).flatMap( tree -> Stream.concat(Stream.of(tree), descendants(tree))); }
KotlinConverter implements ASTConverter { private static Stream<PsiElement> descendants(PsiElement element) { return Arrays.stream(element.getChildren()).flatMap( tree -> Stream.concat(Stream.of(tree), descendants(tree))); } }
KotlinConverter implements ASTConverter { private static Stream<PsiElement> descendants(PsiElement element) { return Arrays.stream(element.getChildren()).flatMap( tree -> Stream.concat(Stream.of(tree), descendants(tree))); }  }
KotlinConverter implements ASTConverter { private static Stream<PsiElement> descendants(PsiElement element) { return Arrays.stream(element.getChildren()).flatMap( tree -> Stream.concat(Stream.of(tree), descendants(tree))); }  @Override Tree parse(String content); }
KotlinConverter implements ASTConverter { private static Stream<PsiElement> descendants(PsiElement element) { return Arrays.stream(element.getChildren()).flatMap( tree -> Stream.concat(Stream.of(tree), descendants(tree))); }  @Override Tree parse(String content);  }