BaseEditor { protected Supplier<Boolean> getSaveValidator() { return () -> { if (isReadOnly && versionRecordManager.isCurrentLatest()) { baseView.alertReadOnly(); return false; } else if (isReadOnly && !versionRecordManager.isCurrentLatest()) { versionRecordManager.restoreToCurrentVersion(saveWithComments); return false; } if (concurrentUpdateSessionInfo != null) { showConcurrentUpdatePopup(); return false; } else { return true; } }; } BaseEditor(VersionRecordManager versionRecordManager,
               BaseEditorView baseView,
               BasicFileMenuBuilder menuBuilder,
               Event<ChangeTitleWidgetEvent> changeTitleNotification); protected  BaseEditor(); protected  BaseEditor(final BaseEditorView baseView); Validator getRenameValidator(); Validator getCopyValidator(); void setOriginalHash(Integer originalHash); String getTitleText(); RemoteCallback<Path> getSaveSuccessCallback(final int newHash); void onRestore(@Observes RestoreEvent restore); void reload(); void disableMenuItem(final MenuItems menuItem); void enableMenuItem(final MenuItems menuItem); void getMenus(final Consumer<Menus> menusConsumer); Command getValidateCommand(); boolean mayClose(Integer currentHash); boolean isDirty(Integer currentHash); VersionRecordManager getVersionRecordManager(); void setMetadataOriginalHash(final Integer metadataOriginalHash);  }
@Test public void testGetSaveValidatorWhenItIsReadOnlyAndItIsCurrentLatest() { editor.isReadOnly = true; doReturn(true).when(versionRecordManager).isCurrentLatest(); final boolean success = editor.getSaveValidator().get(); verify(baseView).alertReadOnly(); assertFalse(success); }
@Test public void testGetSaveValidatorWhenItIsReadOnlyAndItIsNotCurrentLatest() { editor.isReadOnly = true; doReturn(false).when(versionRecordManager).isCurrentLatest(); final boolean success = editor.getSaveValidator().get(); verify(versionRecordManager).restoreToCurrentVersion(true); assertFalse(success); }
@Test public void testGetSaveValidatorWhenConcurrentUpdateSessionInfoIsNull() { editor.isReadOnly = false; editor.concurrentUpdateSessionInfo = null; final boolean success = editor.getSaveValidator().get(); assertTrue(success); }