@Test public void loadSelectedCategory() { }
public Category loadSelectedCategory() { String breadcrumb = storageHandler.loadSelectedCategory(); Category defaultCategory = getCategories().get(DEFAULT_CATEGORY); if (breadcrumb == null) { return defaultCategory; } return flatCategoriesLst.stream() .filter(category -> category.getBreadcrumb().equals(breadcrumb)) .findAny().orElse(defaultCategory); }
PreferencesFxModel { public Category loadSelectedCategory() { String breadcrumb = storageHandler.loadSelectedCategory(); Category defaultCategory = getCategories().get(DEFAULT_CATEGORY); if (breadcrumb == null) { return defaultCategory; } return flatCategoriesLst.stream() .filter(category -> category.getBreadcrumb().equals(breadcrumb)) .findAny().orElse(defaultCategory); } }
PreferencesFxModel { public Category loadSelectedCategory() { String breadcrumb = storageHandler.loadSelectedCategory(); Category defaultCategory = getCategories().get(DEFAULT_CATEGORY); if (breadcrumb == null) { return defaultCategory; } return flatCategoriesLst.stream() .filter(category -> category.getBreadcrumb().equals(breadcrumb)) .findAny().orElse(defaultCategory); } PreferencesFxModel(
      StorageHandler storageHandler,
      SearchHandler searchHandler,
      History history,
      Category[] categories
  ); }
PreferencesFxModel { public Category loadSelectedCategory() { String breadcrumb = storageHandler.loadSelectedCategory(); Category defaultCategory = getCategories().get(DEFAULT_CATEGORY); if (breadcrumb == null) { return defaultCategory; } return flatCategoriesLst.stream() .filter(category -> category.getBreadcrumb().equals(breadcrumb)) .findAny().orElse(defaultCategory); } PreferencesFxModel(
      StorageHandler storageHandler,
      SearchHandler searchHandler,
      History history,
      Category[] categories
  ); List<Category> getCategories(); boolean isPersistWindowState(); void setPersistWindowState(boolean persistWindowState); boolean isSaveSettings(); void setSaveSettings(boolean saveSettings); History getHistory(); StorageHandler getStorageHandler(); boolean getHistoryDebugState(); void setHistoryDebugState(boolean historyDebugState); void saveSelectedCategory(); Category loadSelectedCategory(); void loadSettingValues(); Category getDisplayedCategory(); void setDisplayedCategory(Category displayedCategory); ReadOnlyObjectProperty<Category> displayedCategoryProperty(); String getSearchText(); void setSearchText(String searchText); StringProperty searchTextProperty(); List<Category> getFlatCategoriesLst(); SearchHandler getSearchHandler(); boolean getButtonsVisible(); BooleanProperty buttonsVisibleProperty(); void setButtonsVisible(boolean buttonsVisible); boolean isInstantPersistent(); BooleanProperty instantPersistentProperty(); void setInstantPersistent(boolean instantPersistent); TranslationService getTranslationService(); ObjectProperty<TranslationService> translationServiceProperty(); void setTranslationService(TranslationService translationService); double getDividerPosition(); DoubleProperty dividerPositionProperty(); void setDividerPosition(double dividerPosition); boolean isOneCategoryLayout(); void addEventHandler(EventType<PreferencesFxEvent> eventType,
                              EventHandler<? super PreferencesFxEvent> eventHandler); void removeEventHandler(EventType<PreferencesFxEvent> eventType,
                                 EventHandler<? super PreferencesFxEvent> eventHandler); void saveSettings(); void discardChanges(); }
PreferencesFxModel { public Category loadSelectedCategory() { String breadcrumb = storageHandler.loadSelectedCategory(); Category defaultCategory = getCategories().get(DEFAULT_CATEGORY); if (breadcrumb == null) { return defaultCategory; } return flatCategoriesLst.stream() .filter(category -> category.getBreadcrumb().equals(breadcrumb)) .findAny().orElse(defaultCategory); } PreferencesFxModel(
      StorageHandler storageHandler,
      SearchHandler searchHandler,
      History history,
      Category[] categories
  ); List<Category> getCategories(); boolean isPersistWindowState(); void setPersistWindowState(boolean persistWindowState); boolean isSaveSettings(); void setSaveSettings(boolean saveSettings); History getHistory(); StorageHandler getStorageHandler(); boolean getHistoryDebugState(); void setHistoryDebugState(boolean historyDebugState); void saveSelectedCategory(); Category loadSelectedCategory(); void loadSettingValues(); Category getDisplayedCategory(); void setDisplayedCategory(Category displayedCategory); ReadOnlyObjectProperty<Category> displayedCategoryProperty(); String getSearchText(); void setSearchText(String searchText); StringProperty searchTextProperty(); List<Category> getFlatCategoriesLst(); SearchHandler getSearchHandler(); boolean getButtonsVisible(); BooleanProperty buttonsVisibleProperty(); void setButtonsVisible(boolean buttonsVisible); boolean isInstantPersistent(); BooleanProperty instantPersistentProperty(); void setInstantPersistent(boolean instantPersistent); TranslationService getTranslationService(); ObjectProperty<TranslationService> translationServiceProperty(); void setTranslationService(TranslationService translationService); double getDividerPosition(); DoubleProperty dividerPositionProperty(); void setDividerPosition(double dividerPosition); boolean isOneCategoryLayout(); void addEventHandler(EventType<PreferencesFxEvent> eventType,
                              EventHandler<? super PreferencesFxEvent> eventHandler); void removeEventHandler(EventType<PreferencesFxEvent> eventType,
                                 EventHandler<? super PreferencesFxEvent> eventHandler); void saveSettings(); void discardChanges();  }