private void doTest(@NotNull String before, @NotNull String newName, @NotNull String after) { myFixture.configureByText("foo.go", before); myFixture.renameElementAtCaret(newName); myFixture.checkResult(after); }
public void run() { if (renameWithHandler) { myFixture.renameElementAtCaretUsingHandler("myFunction_renamed"); } else { myFixture.renameElementAtCaret("myFunction_renamed"); } } }, sourceFiles);
private void doTest(@NotNull String beforeText, @NotNull String newName, @NotNull String afterText) { myFixture.configureByText(GitFileType.INSTANCE, beforeText); myFixture.renameElementAtCaret(newName); myFixture.checkResult(afterText); } }
public void run() { if (renameWithHandler) { myFixture.renameElementAtCaretUsingHandler("target_renamed.bash"); } else { myFixture.renameElementAtCaret("target_renamed.bash"); } } }, sourceFiles);
private void doTestDoNotRename(@NotNull String text) { myFixture.configureByText("foo.go", text); try { myFixture.renameElementAtCaret("bar"); fail("Shouldn't be performed"); } catch (CommonRefactoringUtil.RefactoringErrorHintException e) { assertEquals("This element cannot be renamed", e.getMessage()); } myFixture.checkResult(text); } }
public void run() { if (renameWithHandler) { myFixture.renameElementAtCaretUsingHandler("a_renamed"); } else { myFixture.renameElementAtCaret("a_renamed"); } } }, sourceFiles);
public void run() { myFixture.renameElementAtCaret("$_RENAMED"); } }, "$_RENAMED", "source.bash");
public void run() { if (renameWithHandler) { myFixture.renameElementAtCaretUsingHandler("EOF_RENAMED"); } else { myFixture.renameElementAtCaret("EOF_RENAMED"); } } }, "EOF_RENAMED", sourceFiles);
public void testRenameField_caretAtFieldName() { myFixture.configureByFiles("rename/field/RenameField_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); OptionNode option = myFixture.findElementByText("(foo).NewName", OptionNode.class); Assert.assertNotNull(option); }
public void testRenameMapField_caretAtOption() { myFixture.configureByFiles("rename/field/RenameMapField_CaretAtOption.proto"); myFixture.renameElementAtCaret("NewName"); MapNode option = myFixture.findElementByText("NewName", MapNode.class); Assert.assertNotNull(option); }
public void testRenameField_caretAtFieldName_OneofOption() { myFixture.configureByFiles("rename/field/RenameField_CaretAtField_OneofOption.proto"); myFixture.renameElementAtCaret("NewName"); OptionNode option = myFixture.findElementByText("(foo).NewName", OptionNode.class); Assert.assertNotNull(option); }
public void testRenameField_caretAtOption() { myFixture.configureByFiles("rename/field/RenameField_CaretAtOption.proto"); myFixture.renameElementAtCaret("NewName"); FieldNode option = myFixture.findElementByText("NewName", FieldNode.class); Assert.assertNotNull(option); }
public void testRenameExtension_caretAtFieldName() { myFixture.configureByFiles("rename/field/RenameExtension_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); FieldNode option = myFixture.findElementByText("NewName", FieldNode.class); Assert.assertNotNull(option); }
public void testRenameOneofField_caretAtFieldName() { myFixture.configureByFiles("rename/field/RenameOneofField_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); OptionNode option = myFixture.findElementByText("(foo).NewName", OptionNode.class); Assert.assertNotNull(option); }
public void testRenameOneofField_caretAtOption() { myFixture.configureByFiles("rename/field/RenameOneofField_CaretAtOption.proto"); myFixture.renameElementAtCaret("NewName"); FieldNode option = myFixture.findElementByText("NewName", FieldNode.class); Assert.assertNotNull(option); }
public void testRenameMapField_caretAtFieldName() { myFixture.configureByFiles("rename/field/RenameMapField_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); OptionNode option = myFixture.findElementByText("(foo).NewName", OptionNode.class); Assert.assertNotNull(option); }
private void doRename(String... sourceFiles) { myFixture.setTestDataPath(getTestDataPath() + getTestName(true)); List<String> filenames = Lists.newArrayList(sourceFiles); myFixture.configureByFiles(filenames.toArray(new String[filenames.size()])); myFixture.renameElementAtCaret("a_renamed"); for (String filename : filenames) { myFixture.checkResultByFile(filename, FileUtil.getNameWithoutExtension(filename) + "_after." + FileUtilRt.getExtension(filename), false); } } }
@Test public void testEscapedVariableRename() throws Exception { myFixture.setTestDataPath(getTestDataPath() + getTestName(true)); myFixture.configureByFiles("source.bash"); myFixture.renameElementAtCaret("X_RENAMED"); myFixture.checkResultByFile("source.bash", "source_after.bash", false); }
@Override public void run() { PsiReference psiReference = myFixture.getFile().findReferenceAt(myFixture.getEditor().getCaretModel().getOffset()); Assert.assertTrue(psiReference.resolve() instanceof BashVarDef); myFixture.renameElementAtCaret("a_renamed"); } }, "source.bash");
@Test public void testFileRename() throws Exception { myFixture.setTestDataPath(getTestDataPath() + getTestName(true)); myFixture.configureByFiles("source.bash", "included.bash"); myFixture.renameElementAtCaret("included_renamed.bash"); myFixture.checkResultByFile("source.bash", "source_after.bash", false); Assert.assertNotNull(myFixture.findFileInTempDir("included_renamed.bash")); //make sure the renamed file exists }