@Test public void testGetVariableSuggestion() { final String variable = "variable"; final JSONValue kind = mock(JSONValue.class); final JSONValue insertTextRules = mock(JSONValue.class); final JSONObject expectedSuggestion = mock(JSONObject.class); final JSONString variableStringValue = mock(JSONString.class); when(factory.makeJSONNumber(4)).thenReturn(kind, insertTextRules); doReturn(expectedSuggestion).when(factory).makeJSONObject(); doReturn(variableStringValue).when(factory).makeJSONString(variable); final JSONValue actualSuggestion = factory.getVariableSuggestion(variable); verify(expectedSuggestion).put("kind", kind); verify(expectedSuggestion).put("insertTextRules", insertTextRules); verify(expectedSuggestion).put("label", variableStringValue); verify(expectedSuggestion).put("insertText", variableStringValue); assertEquals(expectedSuggestion, actualSuggestion); }
JSONValue getVariableSuggestion(final String variable) { final JSONObject suggestion = makeJSONObject(); final int completionItemKindVariable = 4; final int completionItemInsertTextRuleInsertAsSnippet = 4; final JSONString variableSuggestion = makeJSONString(variable); suggestion.put(KIND_KEY, makeJSONNumber(completionItemKindVariable)); suggestion.put(INSERT_TEXT_RULES_KEY, makeJSONNumber(completionItemInsertTextRuleInsertAsSnippet)); suggestion.put(LABEL_KEY, variableSuggestion); suggestion.put(INSERT_TEXT_KEY, variableSuggestion); return suggestion; }
MonacoPropertiesFactory { JSONValue getVariableSuggestion(final String variable) { final JSONObject suggestion = makeJSONObject(); final int completionItemKindVariable = 4; final int completionItemInsertTextRuleInsertAsSnippet = 4; final JSONString variableSuggestion = makeJSONString(variable); suggestion.put(KIND_KEY, makeJSONNumber(completionItemKindVariable)); suggestion.put(INSERT_TEXT_RULES_KEY, makeJSONNumber(completionItemInsertTextRuleInsertAsSnippet)); suggestion.put(LABEL_KEY, variableSuggestion); suggestion.put(INSERT_TEXT_KEY, variableSuggestion); return suggestion; } }
MonacoPropertiesFactory { JSONValue getVariableSuggestion(final String variable) { final JSONObject suggestion = makeJSONObject(); final int completionItemKindVariable = 4; final int completionItemInsertTextRuleInsertAsSnippet = 4; final JSONString variableSuggestion = makeJSONString(variable); suggestion.put(KIND_KEY, makeJSONNumber(completionItemKindVariable)); suggestion.put(INSERT_TEXT_RULES_KEY, makeJSONNumber(completionItemInsertTextRuleInsertAsSnippet)); suggestion.put(LABEL_KEY, variableSuggestion); suggestion.put(INSERT_TEXT_KEY, variableSuggestion); return suggestion; }  }
MonacoPropertiesFactory { JSONValue getVariableSuggestion(final String variable) { final JSONObject suggestion = makeJSONObject(); final int completionItemKindVariable = 4; final int completionItemInsertTextRuleInsertAsSnippet = 4; final JSONString variableSuggestion = makeJSONString(variable); suggestion.put(KIND_KEY, makeJSONNumber(completionItemKindVariable)); suggestion.put(INSERT_TEXT_RULES_KEY, makeJSONNumber(completionItemInsertTextRuleInsertAsSnippet)); suggestion.put(LABEL_KEY, variableSuggestion); suggestion.put(INSERT_TEXT_KEY, variableSuggestion); return suggestion; }  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 { JSONValue getVariableSuggestion(final String variable) { final JSONObject suggestion = makeJSONObject(); final int completionItemKindVariable = 4; final int completionItemInsertTextRuleInsertAsSnippet = 4; final JSONString variableSuggestion = makeJSONString(variable); suggestion.put(KIND_KEY, makeJSONNumber(completionItemKindVariable)); suggestion.put(INSERT_TEXT_RULES_KEY, makeJSONNumber(completionItemInsertTextRuleInsertAsSnippet)); suggestion.put(LABEL_KEY, variableSuggestion); suggestion.put(INSERT_TEXT_KEY, variableSuggestion); return suggestion; }  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; }