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