void () { doTest("{"); } public void testBackspaceTopLevelBracket() { doBackspaceTest(); } public void testBackspaceInternalBracket() { doBackspaceTest(); } public void testBackspaceTopLevelBrace() { doBackspaceTest(); } public void testBackspaceInternalBrace() { doBackspaceTest(); } public void testRemoveHyphenOnEnterInTheMiddleItem() { doTest("\n"); } public void testRemoveHyphenOnEnterInTheLastItem() { doTest("\n"); } public void testDoNotInsertHyphen() { doTest("\n"); } public void testAutoDecreaseHyphenIndent() { doTestForSettings("- ", false, true); } public void testAutoIncreaseHyphenIndent() { doTestForSettings("- ", true, true); } public void testDoNotChangeHyphenIndent1() { doTest("- "); } public void testDoNotChangeHyphenIndent2() { doTest("- "); } private void doTest(@NotNull String insert) { doTest(() -> myFixture.type(insert)); } private void doBackspaceTest() { doTest(() -> myFixture.performEditorAction(IdeActions.ACTION_EDITOR_BACKSPACE)); } private void doTest(@NotNull Runnable actions) { String testName = getTestName(true); myFixture.configureByFile(testName + ".before.yml"); actions.run(); myFixture.checkResultByFile(testName + ".after.yml"); } private void doTestForSettings(@NotNull String insert, boolean indentSequenceVal, boolean autoHyphen) { String testName = getTestName(true); String fileName = ObjectUtils.notNull(StringUtil.substringBefore(testName, "_"), testName); myFixture.configureByFile(fileName + ".before.yml"); boolean backupIndentSequenceVal = getCustomSettings().INDENT_SEQUENCE_VALUE; getCustomSettings().INDENT_SEQUENCE_VALUE = indentSequenceVal; boolean backupAutoHyphen = getCustomSettings().AUTOINSERT_SEQUENCE_MARKER; getCustomSettings().AUTOINSERT_SEQUENCE_MARKER = autoHyphen; myFixture.type(insert); myFixture.checkResultByFile(fileName + ".after.yml"); getCustomSettings().INDENT_SEQUENCE_VALUE = backupIndentSequenceVal; getCustomSettings().AUTOINSERT_SEQUENCE_MARKER = backupAutoHyphen; } @NotNull private YAMLCodeStyleSettings getCustomSettings() { return CodeStyle.getCustomSettings(myFixture.getFile(), YAMLCodeStyleSettings.class); } }