void () { myFixture.configureByFile(fileName()); int offset = myFixture.getEditor().getCaretModel().getOffset(); PsiElement elementAt = myFixture.getFile().findElementAt(offset); assertNotNull("Caret should be set for tested file", elementAt); KtClass ktClass = PsiTreeUtil.getParentOfType(elementAt, KtClass.class); assertNotNull("Caret should be placed to class definition", ktClass); // Should not fail! KtLightClass lightClass = toLightClass(ktClass); assertNotNull(String.format("Failed to wrap ktClass '%s' to class", ktClass.getText()), lightClass); }