void () { PsiFile main = myFixture.configureByText("Main.java", "class Mai<caret>n {}"); PsiClass direct1 = myFixture.addClass("class Direct1 extends Main {}"); PsiClass direct2 = myFixture.addClass("class Direct2 extends Main {}"); PsiClass indirect = myFixture.addClass("class Indirect extends Direct1 {}"); IntentionAction action = new SealClassAction().asIntention(); assertTrue(action.isAvailable(getProject(), getEditor(), getFile())); WriteCommandAction.runWriteCommandAction(getProject(), () -> { action.invoke(getProject(), getEditor(), getFile()); }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); assertEquals("sealed class Main permits Direct1, Direct2 {}", main.getText()); assertEquals("non-sealed class Direct1 extends Main {}", direct1.getText()); assertEquals("non-sealed class Direct2 extends Main {}", direct2.getText()); assertEquals("class Indirect extends Direct1 {}", indirect.getText()); }