use of org.jetbrains.yaml.psi.YAMLKeyValue in project intellij-community by JetBrains.
the class YAMLMappingModificationTest method doValueTest.
private void doValueTest(final String valueText) {
myFixture.configureByFile(getTestName(true) + ".yml");
final int offset = myFixture.getCaretOffset();
final PsiElement elementAtCaret = myFixture.getFile().findElementAt(offset);
final YAMLKeyValue keyValue = PsiTreeUtil.getParentOfType(elementAtCaret, YAMLKeyValue.class, false);
assertNotNull(keyValue);
final YAMLKeyValue dummyKV = YAMLElementGenerator.getInstance(myFixture.getProject()).createYamlKeyValue("foo", valueText);
assertNotNull(dummyKV.getValue());
WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> keyValue.setValue(dummyKV.getValue()));
assertSameLinesWithFile(getTestDataPath() + getTestName(true) + ".txt", myFixture.getFile().getText(), false);
}
Aggregations