@Test public void testBothDirty_1() throws Exception { assertFalse(refactoringPreferences.isSaveAllBeforeRefactoring()); smudge(fooEditor, barEditor); renameFooToFooBar(barEditor); assertTrue(fooEditor.isDirty()); assertTrue(barEditor.isDirty()); }
protected void smudge(ITextEditor... editors) throws BadLocationException { for (ITextEditor editor : editors) { IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput()); document.replace(document.getLength(), 0, " "); if (editor instanceof XtextEditor) { waitForReconciler((XtextEditor) editor); } waitForDisplay(); assertTrue(editor.isDirty()); } }
@Override public void setUp() throws Exception { super.setUp(); IJavaProject project = JavaProjectSetupUtil.createJavaProject(TEST_PROJECT); addNature(project.getProject(), XtextProjectHelper.NATURE_ID); Injector injector = Activator.getInstance().getInjector(getEditorId()); injector.injectMembers(this); IFile fooFile = IResourcesSetupUtil.createFile(TEST_PROJECT + "/foo.refactoringtestlanguage", "foo"); IFile barFile = IResourcesSetupUtil.createFile( TEST_PROJECT + "/bar.refactoringtestlanguage", "bar { ref foo }"); waitForAutoBuild(); fooEditor = openEditor(fooFile); barEditor = openEditor(barFile); assertTrue(refactoringPreferences.useInlineRefactoring()); }
public void assertTestFailed(String name) { assertTestRun(name); assertTrue(name + " passed! Expected to fail", testCaseEvents.get(name).failed()); }