You open Neovim, your preferred editor, with the intention of running tests without having to leave your preferred environment.
This Neovim plugin, java-maven-test.nvim, integrates with telescope.nvim and nvim-treesitter to facilitate interactive fuzzy searching and execution of Java tests within a class.
java-maven-test.nvim/
āāā LICENSE
āāā lua
āĀ Ā āāā java-maven-test
āĀ Ā āāā commands.lua # Commands exposed to Neovim
āĀ Ā āāā ui.lua # UI logic (pickers and layout)
āĀ Ā āāā init.lua # Plugin entry point
āĀ Ā āāā notify.lua # Notification-related logic
āĀ Ā āāā mvn.lua # Maven-related logic
āĀ Ā āāā util.lua # Utility functions
āāā README.md
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'rcarriga/nvim-notify'
Plug 'jkeresman01/java-maven-test.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
use 'nvim-treesitter/nvim-treesitter'
use 'rcarriga/nvim-notify'
use 'jkeresman01/java-maven-test.nvim'
Following commands have been exposed to Neovim:
Commands
:MavenTest -- Launch picker (select your test case from UI)
:MavenTestAtCursor -- Execute test at cursor
:MavenTestAllInClass -- Execute all tests in class
Set the keymapings as you see fit, here is one example:
require('java-maven-test').setup()
vim.keymap.set("n", "<leader>ft", "<cmd>MavenTest<CR>")
vim.keymap.set("n", "<leader>rt", "<cmd>MavenTestAtCursor<CR>")
vim.keymap.set("n", "<leader>ra", "<cmd>MavenTestAllInClass<CR>")
Key - map | Action |
---|---|
<leader>rt |
Execute test under the cursor |
<leader>ra |
Execute all tests in currently opened class |
<leader>ft |
Fuzzy find trough tests in a given class and execute selected one |