private void verifyDirtyStateChanges(TestSaveableEditorInput compareEditorInput)
      throws IllegalArgumentException, SecurityException, IllegalAccessException,
          NoSuchFieldException {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

    TextMergeViewer viewer =
        (TextMergeViewer)
            compareEditorInput.findContentViewer(null, compareEditorInput.input, shell);
    viewer.setInput(compareEditorInput.getCompareResult());

    MergeSourceViewer left = (MergeSourceViewer) ReflectionUtils.getField(viewer, "fLeft");

    StyledText leftText = left.getSourceViewer().getTextWidget();

    // modify the left side of editor
    leftText.append(appendFileContents);

    assertTrue(compareEditorInput.isDirty());

    // save editor
    viewer.flush(null);

    assertFalse(compareEditorInput.isDirty());
  }