void (VirtualFile file, @Nullable final UnlockOption option, boolean fileHasBeenChanged) { Editor editor = getEditor(file); NullableFunction<List<VirtualFile>, UnlockOption> unlocker = files -> option; NonProjectFileWritingAccessProvider.setCustomUnlocker(unlocker); String before = editor.getDocument().getText(); typeInChar(editor, 'a'); if (fileHasBeenChanged) { assertEquals("Text should be changed", 'a' + before, editor.getDocument().getText()); } else { assertEquals("Text should not be changed", before, editor.getDocument().getText()); } }