Search in sources :

Example 1 with SpecificationController

use of com.faforever.client.query.SpecificationController in project downlords-faf-client by FAForever.

the class SearchControllerTest method setUp.

@Before
public void setUp() throws Exception {
    when(uiService.loadFxml("theme/vault/search/logical_node.fxml")).thenAnswer(invocation -> {
        LogicalNodeController controller = mock(LogicalNodeController.class);
        controller.logicalOperatorField = new ChoiceBox<>();
        controller.specificationController = mock(SpecificationController.class);
        controller.specificationController.propertyField = new ComboBox<>();
        controller.specificationController.operationField = new ChoiceBox<>();
        controller.specificationController.valueField = new ComboBox<>();
        when(controller.getRoot()).thenReturn(new Pane());
        return controller;
    });
    when(preferencesService.getPreferences()).thenReturn(new Preferences());
    instance = new SearchController(uiService, i18n, preferencesService);
    loadFxml("theme/vault/search/search.fxml", clazz -> {
        if (SpecificationController.class.isAssignableFrom(clazz)) {
            return specificationController;
        }
        if (LogicalNodeController.class.isAssignableFrom(clazz)) {
            return logicalNodeController;
        }
        return instance;
    });
    instance.setSearchableProperties(SearchableProperties.GAME_PROPERTIES);
    instance.setSortConfig(preferencesService.getPreferences().getVaultPrefs().onlineReplaySortConfigProperty());
}
Also used : LogicalNodeController(com.faforever.client.query.LogicalNodeController) SpecificationController(com.faforever.client.query.SpecificationController) Preferences(com.faforever.client.preferences.Preferences) Pane(javafx.scene.layout.Pane) Before(org.junit.Before)

Aggregations

Preferences (com.faforever.client.preferences.Preferences)1 LogicalNodeController (com.faforever.client.query.LogicalNodeController)1 SpecificationController (com.faforever.client.query.SpecificationController)1 Pane (javafx.scene.layout.Pane)1 Before (org.junit.Before)1