@Test public void testGetSuggestions() { final JSONArray expectedSuggestions = mock(JSONArray.class); final List<JSONValue> suggestions = new ArrayList<>(); final List<String> variableSuggestions = buildVariableSuggestions(); when(this.variableSuggestions.getSuggestions()).thenReturn(variableSuggestions); buildKeywordSuggestions().forEach(suggestion -> { final JSONValue keyword = mock(JSONValue.class); suggestions.add(keyword); doReturn(keyword).when(factory).getKeywordSuggestion(suggestion); }); buildFunctionSuggestions().forEach(suggestion -> { final JSONValue function = mock(JSONValue.class); suggestions.add(function); doReturn(function).when(factory).getFunctionSuggestion(suggestion.get(0), suggestion.get(1)); }); variableSuggestions.forEach(suggestion -> { final JSONValue variable = mock(JSONValue.class); suggestions.add(variable); doReturn(variable).when(factory).getVariableSuggestion(suggestion); }); doReturn(expectedSuggestions).when(factory).makeJSONArray(); final JSONArray actualSuggestions = factory.getSuggestions(this.variableSuggestions); suggestions.forEach(suggestion -> { verify(factory).push(expectedSuggestions, suggestion); }); assertEquals(expectedSuggestions, actualSuggestions); }
JSONArray getSuggestions(final MonacoFEELVariableSuggestions variableSuggestions) { final JSONArray suggestionTypes = makeJSONArray(); populateKeywordSuggestions(suggestionTypes); populateVariableSuggestions(variableSuggestions, suggestionTypes); populateFunctionSuggestions(suggestionTypes); return suggestionTypes; }
MonacoPropertiesFactory { JSONArray getSuggestions(final MonacoFEELVariableSuggestions variableSuggestions) { final JSONArray suggestionTypes = makeJSONArray(); populateKeywordSuggestions(suggestionTypes); populateVariableSuggestions(variableSuggestions, suggestionTypes); populateFunctionSuggestions(suggestionTypes); return suggestionTypes; } }
MonacoPropertiesFactory { JSONArray getSuggestions(final MonacoFEELVariableSuggestions variableSuggestions) { final JSONArray suggestionTypes = makeJSONArray(); populateKeywordSuggestions(suggestionTypes); populateVariableSuggestions(variableSuggestions, suggestionTypes); populateFunctionSuggestions(suggestionTypes); return suggestionTypes; }  }
MonacoPropertiesFactory { JSONArray getSuggestions(final MonacoFEELVariableSuggestions variableSuggestions) { final JSONArray suggestionTypes = makeJSONArray(); populateKeywordSuggestions(suggestionTypes); populateVariableSuggestions(variableSuggestions, suggestionTypes); populateFunctionSuggestions(suggestionTypes); return suggestionTypes; }  JavaScriptObject getConstructionOptions(); JavaScriptObject getThemeData(); JSONArray getRules(); JavaScriptObject getCompletionItemProvider(final MonacoFEELVariableSuggestions variableSuggestions); JavaScriptObject getLanguageDefinition(); JSONValue getTokenizer(); JSONArray getRoot(); JSONArray row(final String pattern,
                         final String name); JavaScriptObject getLanguage(); }
MonacoPropertiesFactory { JSONArray getSuggestions(final MonacoFEELVariableSuggestions variableSuggestions) { final JSONArray suggestionTypes = makeJSONArray(); populateKeywordSuggestions(suggestionTypes); populateVariableSuggestions(variableSuggestions, suggestionTypes); populateFunctionSuggestions(suggestionTypes); return suggestionTypes; }  JavaScriptObject getConstructionOptions(); JavaScriptObject getThemeData(); JSONArray getRules(); JavaScriptObject getCompletionItemProvider(final MonacoFEELVariableSuggestions variableSuggestions); JavaScriptObject getLanguageDefinition(); JSONValue getTokenizer(); JSONArray getRoot(); JSONArray row(final String pattern,
                         final String name); JavaScriptObject getLanguage(); static final String FEEL_LANGUAGE_ID; static final String FEEL_THEME_ID; }