### Question:
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);  }### Answer:
@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 {}")); }
@Test public void testEnumClassEntries() { Tree tree = kotlin("enum class A { B, C, D }"); assertTree(tree).isInstanceOf(ClassDeclarationTree.class); assertThat(tree.descendants().noneMatch(ClassDeclarationTree.class::isInstance)).isTrue(); }
@Test public void testNestedClasses() { Tree tree = kotlin("class A { class B { class C {} } }"); assertTree(tree).isInstanceOf(ClassDeclarationTree.class); assertThat(tree.descendants().filter(ClassDeclarationTree.class::isInstance).count()).isEqualTo(2); }