Plugin to run Java tests in a toggleterm, on the background or on a floating terminal. Currently only supports Maven projects.
Warning
- plugin is in beta stage and not stable
- changes will happen
{
"tvntvn13/java-test-util.nvim",
ft = { "java" },
config = function()
require("java_test_util").setup({})
end,
dependencies = {
"nvim-treesitter/nvim-treesitter",
"akinsho/toggleterm.nvim",
},
},
Note
- plugin currently only supports floating terminal
local config = {
use_maven_wrapper = false,
hide_terminal = true,
terminal_height = 25,
terminal_width = 90,
terminal_border = "curved",
display_name = "mvn test",
title_pos = "center",
direction = "float",
auto_scroll = true,
close_on_exit = false,
timeout_len = 5000,
toggle_key = "<leader>Mm",
close_key = "q",
}
Plugin exposes 4 commands to run maven tests:
- MvnRunMethod -- run test for current method
- MvnRunClass -- run tests for current class
- MvnRunPackage -- run tests for current package
- MvnRunPrev -- re-run previous tests
- MvnRunAll -- run all tests
You can set keymaps to these commands for example:
vim.api.nvim_set_keymap("n", "<leader>Mt", "<cmd>MvnRunMethod<cr>", { desc = "Run tests for current method", noremap = true, silent = true})