@Test public void evalTest() throws InterruptedException, ExecutionException { var expectedResult = "expression result"; assertNormalBehavior( () -> CompletableFuture.completedFuture(new ResponseMessage(1, null, expectedResult)), () -> neovimStreamApi.eval("real expression"), request -> assertMethodAndArguments(request, NeovimApi.EVAL, "real expression"), result -> assertEquals(expectedResult, result) ); assertErrorBehavior( () -> neovimStreamApi.eval("bad expression"), request -> assertMethodAndArguments(request, NeovimApi.EVAL, "bad expression") ); }
@Override public CompletableFuture<Object> eval(String expression) { return sendWithGenericResponse(new RequestMessage.Builder(EVAL).addArgument(expression)); }
NeovimStreamApi extends BaseStreamApi implements NeovimApi { @Override public CompletableFuture<Object> eval(String expression) { return sendWithGenericResponse(new RequestMessage.Builder(EVAL).addArgument(expression)); } }
NeovimStreamApi extends BaseStreamApi implements NeovimApi { @Override public CompletableFuture<Object> eval(String expression) { return sendWithGenericResponse(new RequestMessage.Builder(EVAL).addArgument(expression)); } NeovimStreamApi(ReactiveRpcStreamer reactiveRpcStreamer); }
NeovimStreamApi extends BaseStreamApi implements NeovimApi { @Override public CompletableFuture<Object> eval(String expression) { return sendWithGenericResponse(new RequestMessage.Builder(EVAL).addArgument(expression)); } NeovimStreamApi(ReactiveRpcStreamer reactiveRpcStreamer); @Override CompletableFuture<List> sendAtomic(AtomicCallBuilder atomicCallBuilder); @Override AtomicCallBuilder prepareAtomic(); @Override CompletableFuture<Map> getHighlightById(int id, boolean rgb); @Override CompletableFuture<Map> getHighlightByName(String name, boolean rgb); @Override CompletableFuture<Void> attachUi(int width, int height, UiOptions options); @Override CompletableFuture<Void> detachUi(); @Override CompletableFuture<Void> resizeUi(int width, int height); @Override CompletableFuture<Void> resizeUiGrid(int width, int height); @Override CompletableFuture<Void> setPopupmenuHeight(int height); @Override CompletableFuture<Void> inputMouse(Mouse.Button button, Mouse.Action action, String modifier, int grid, int row, int col); @Override CompletableFuture<Object> executeLua(String luaCode, List<String> args); @Override CompletableFuture<Void> executeCommand(String command); @Override CompletableFuture<Void> setCurrentDir(String directoryPath); @Override CompletableFuture<Void> subscribeToEvent(String event); @Override CompletableFuture<Void> unsubscribeFromEvent(String event); @Override CompletableFuture<Object> eval(String expression); @Override CompletableFuture<Object> callFunction(String name, List<Object> args); @Override CompletableFuture<Void> feedKeys(String keys, String mode, boolean escape); @Override CompletableFuture<Integer> input(String keys); @Override CompletableFuture<List<VimKeyMap>> getKeymap(String mode); @Override CompletableFuture<Void> setKeymap(String mode, String lhs, String rhs, Map<String, Boolean> options); @Override CompletableFuture<Void> deleteKeymap(String mode, String lhs); @Override CompletableFuture<Void> setUiOption(String name, Object value); @Override CompletableFuture<Void> setVariable(String name, Object value); @Override CompletableFuture<Object> getVariable(String name); @Override CompletableFuture<Void> deleteVariable(String name); @Override CompletableFuture<Object> getVimVariable(String name); @Override CompletableFuture<Void> setVimVariable(String name, Object value); @Override CompletableFuture<Void> setOption(String name, Object value); @Override CompletableFuture<Object> getOption(String name); @Override CompletableFuture<Integer> getColorByName(String name); @Override CompletableFuture<String> replaceTermcodes(String strToReplace, boolean fromPart, boolean doLt, boolean special); @Override CompletableFuture<String> commandOutput(String command); @Override CompletableFuture<Void> writeToOutput(String text); @Override CompletableFuture<Void> writeToError(String text); @Override CompletableFuture<Void> writelnToError(String text); @Override CompletableFuture<Integer> stringWidth(String string); @Override CompletableFuture<List<String>> listRuntimePaths(); @Override CompletableFuture<String> getCurrentLine(); @Override CompletableFuture<Void> setCurrentLine(String lineContent); @Override CompletableFuture<Void> deleteCurrentLine(); @Override CompletableFuture<List<NeovimBufferApi>> getBuffers(); @Override CompletableFuture<NeovimBufferApi> createBuffer(boolean listed, boolean scratch); @Override CompletableFuture<NeovimBufferApi> getCurrentBuffer(); @Override CompletableFuture<Void> setCurrentBuffer(Buffer buffer); @Override CompletableFuture<Void> setCurrentWindow(Window window); @Override CompletableFuture<Void> setCurrentTabpage(Tabpage tabpage); @Override CompletableFuture<List<NeovimWindowApi>> getWindows(); @Override CompletableFuture<NeovimWindowApi> openWindow(Buffer buffer, boolean enter, Map<String, Object> config); @Override CompletableFuture<NeovimWindowApi> getCurrentWindow(); @Override CompletableFuture<List<NeovimTabpageApi>> getTabpages(); @Override CompletableFuture<NeovimTabpageApi> getCurrentTabpage(); @Override CompletableFuture<VimColorMap> getColorMap(); @Override CompletableFuture<VimMode> getMode(); @Override CompletableFuture<ApiInfo> getApiInfo(); @Override CompletableFuture<Object> callDictFunction(Map map, String function, List args); @Override CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions getCommandsOptions); @Override CompletableFuture<Void> setClientInfo(String name, ClientVersionInfo clientVersionInfo, ClientType clientType, Map<String, MethodInfo> methods, ClientAttributes clientAttributes); @Override CompletableFuture<ChannelInfo> getChannelInfo(int channel); @Override CompletableFuture<List<ChannelInfo>> getChannels(); @Override CompletableFuture<Map> parseExpression(String expression, String flags, boolean highlight); @Override CompletableFuture<List<UiInfo>> getUis(); @Override CompletableFuture<List<Integer>> getProcessChildren(); @Override CompletableFuture<Object> getProcess(); @Override CompletableFuture<Map<String, Integer>> getNamespaces(); @Override CompletableFuture<Integer> createNamespace(String name); @Override CompletableFuture<Boolean> paste(String data, boolean crlf, int phase); @Override CompletableFuture<Void> put(List<String> lines, String type, boolean after, boolean follow); @Override CompletableFuture<Map<String, Object>> getContext(Map<String, Object> options); @Override CompletableFuture<Void> loadContext(Map<String, Object> contextMap); @Override CompletableFuture<Void> selectPopupmenuItem(int item, boolean insert, boolean finish, Map<String, Object> options); }
NeovimStreamApi extends BaseStreamApi implements NeovimApi { @Override public CompletableFuture<Object> eval(String expression) { return sendWithGenericResponse(new RequestMessage.Builder(EVAL).addArgument(expression)); } NeovimStreamApi(ReactiveRpcStreamer reactiveRpcStreamer); @Override CompletableFuture<List> sendAtomic(AtomicCallBuilder atomicCallBuilder); @Override AtomicCallBuilder prepareAtomic(); @Override CompletableFuture<Map> getHighlightById(int id, boolean rgb); @Override CompletableFuture<Map> getHighlightByName(String name, boolean rgb); @Override CompletableFuture<Void> attachUi(int width, int height, UiOptions options); @Override CompletableFuture<Void> detachUi(); @Override CompletableFuture<Void> resizeUi(int width, int height); @Override CompletableFuture<Void> resizeUiGrid(int width, int height); @Override CompletableFuture<Void> setPopupmenuHeight(int height); @Override CompletableFuture<Void> inputMouse(Mouse.Button button, Mouse.Action action, String modifier, int grid, int row, int col); @Override CompletableFuture<Object> executeLua(String luaCode, List<String> args); @Override CompletableFuture<Void> executeCommand(String command); @Override CompletableFuture<Void> setCurrentDir(String directoryPath); @Override CompletableFuture<Void> subscribeToEvent(String event); @Override CompletableFuture<Void> unsubscribeFromEvent(String event); @Override CompletableFuture<Object> eval(String expression); @Override CompletableFuture<Object> callFunction(String name, List<Object> args); @Override CompletableFuture<Void> feedKeys(String keys, String mode, boolean escape); @Override CompletableFuture<Integer> input(String keys); @Override CompletableFuture<List<VimKeyMap>> getKeymap(String mode); @Override CompletableFuture<Void> setKeymap(String mode, String lhs, String rhs, Map<String, Boolean> options); @Override CompletableFuture<Void> deleteKeymap(String mode, String lhs); @Override CompletableFuture<Void> setUiOption(String name, Object value); @Override CompletableFuture<Void> setVariable(String name, Object value); @Override CompletableFuture<Object> getVariable(String name); @Override CompletableFuture<Void> deleteVariable(String name); @Override CompletableFuture<Object> getVimVariable(String name); @Override CompletableFuture<Void> setVimVariable(String name, Object value); @Override CompletableFuture<Void> setOption(String name, Object value); @Override CompletableFuture<Object> getOption(String name); @Override CompletableFuture<Integer> getColorByName(String name); @Override CompletableFuture<String> replaceTermcodes(String strToReplace, boolean fromPart, boolean doLt, boolean special); @Override CompletableFuture<String> commandOutput(String command); @Override CompletableFuture<Void> writeToOutput(String text); @Override CompletableFuture<Void> writeToError(String text); @Override CompletableFuture<Void> writelnToError(String text); @Override CompletableFuture<Integer> stringWidth(String string); @Override CompletableFuture<List<String>> listRuntimePaths(); @Override CompletableFuture<String> getCurrentLine(); @Override CompletableFuture<Void> setCurrentLine(String lineContent); @Override CompletableFuture<Void> deleteCurrentLine(); @Override CompletableFuture<List<NeovimBufferApi>> getBuffers(); @Override CompletableFuture<NeovimBufferApi> createBuffer(boolean listed, boolean scratch); @Override CompletableFuture<NeovimBufferApi> getCurrentBuffer(); @Override CompletableFuture<Void> setCurrentBuffer(Buffer buffer); @Override CompletableFuture<Void> setCurrentWindow(Window window); @Override CompletableFuture<Void> setCurrentTabpage(Tabpage tabpage); @Override CompletableFuture<List<NeovimWindowApi>> getWindows(); @Override CompletableFuture<NeovimWindowApi> openWindow(Buffer buffer, boolean enter, Map<String, Object> config); @Override CompletableFuture<NeovimWindowApi> getCurrentWindow(); @Override CompletableFuture<List<NeovimTabpageApi>> getTabpages(); @Override CompletableFuture<NeovimTabpageApi> getCurrentTabpage(); @Override CompletableFuture<VimColorMap> getColorMap(); @Override CompletableFuture<VimMode> getMode(); @Override CompletableFuture<ApiInfo> getApiInfo(); @Override CompletableFuture<Object> callDictFunction(Map map, String function, List args); @Override CompletableFuture<Map<String, CommandInfo>> getCommands(GetCommandsOptions getCommandsOptions); @Override CompletableFuture<Void> setClientInfo(String name, ClientVersionInfo clientVersionInfo, ClientType clientType, Map<String, MethodInfo> methods, ClientAttributes clientAttributes); @Override CompletableFuture<ChannelInfo> getChannelInfo(int channel); @Override CompletableFuture<List<ChannelInfo>> getChannels(); @Override CompletableFuture<Map> parseExpression(String expression, String flags, boolean highlight); @Override CompletableFuture<List<UiInfo>> getUis(); @Override CompletableFuture<List<Integer>> getProcessChildren(); @Override CompletableFuture<Object> getProcess(); @Override CompletableFuture<Map<String, Integer>> getNamespaces(); @Override CompletableFuture<Integer> createNamespace(String name); @Override CompletableFuture<Boolean> paste(String data, boolean crlf, int phase); @Override CompletableFuture<Void> put(List<String> lines, String type, boolean after, boolean follow); @Override CompletableFuture<Map<String, Object>> getContext(Map<String, Object> options); @Override CompletableFuture<Void> loadContext(Map<String, Object> contextMap); @Override CompletableFuture<Void> selectPopupmenuItem(int item, boolean insert, boolean finish, Map<String, Object> options);  }