void (final String key, final String content) { myFixture.configureByFile(getTestName(true) + ".yml"); final int offset = myFixture.getCaretOffset(); final PsiElement elementAtCaret = myFixture.getFile().findElementAt(offset); final YAMLMapping mapping = PsiTreeUtil.getParentOfType(elementAtCaret, YAMLMapping.class, false); if (mapping == null) { WriteCommandAction.runWriteCommandAction(getProject(), () -> { YAMLUtil.createI18nRecord((YAMLFile)myFixture.getFile(), new String[]{key}, content); }); } else { assertNotNull(mapping); //final int indent = YAMLUtil.getIndentInThisLine(mapping); //final String indentString = StringUtil.repeatSymbol(' ', indent); final YAMLKeyValue dummyKeyValue = YAMLElementGenerator.getInstance(myFixture.getProject()).createYamlKeyValue(key, content); assertNotNull(dummyKeyValue); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> mapping.putKeyValue(dummyKeyValue)); } assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText(), false); }