void () { FindModel findModel = new FindModel(); findModel.setStringToFind("bug_(?=here)"); findModel.setStringToReplace("$0"); findModel.setWholeWordsOnly(false); findModel.setFromCursor(false); findModel.setGlobal(true); findModel.setMultipleFiles(false); findModel.setProjectScope(true); findModel.setRegularExpressions(true); findModel.setPromptOnReplace(false); myFindManager.setFindNextModel(null); myFindManager.getFindInFileModel().copyFrom(findModel); String text = "bug_here\nbug_here"; configureByText(FileTypes.PLAIN_TEXT, text); assertTrue(FindUtil.replace(getProject(), getEditor(), 0, findModel)); assertEquals(text, getEditor().getDocument().getText()); }