void () { myFixture.configureByFile(getTestName(true) + ".yml"); final PsiElement element = myFixture.getElementAtCaret(); final YAMLKeyValue keyValue = PsiTreeUtil.getParentOfType(element, YAMLKeyValue.class, false); WriteCommandAction.runWriteCommandAction(getProject(), () -> keyValue.getParentMapping().deleteKeyValue(keyValue)); assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText()); }