Originally posted by **s1n7ax** November 19, 2023
I'm working on https://github.com/nvim-java/nvim-java. So far, I have created only two APIs to run tests.
- `run_current_test_class`
- `debug_current_test_class`
Both these are ran using `nvim-dap` & test discovery is done by communicating to `jdtls` language server.
However, I would like to have an adapter so I can get all the neotest features come with it. However, I don't really understand how to do asynchronous stuff from the given adapter interface. I can see that you have the `@async` annotation in each method, however, there is no callback function passed to any APIs.
So I would like to get help on
- doing async stuff
For instance, there is a language sever command for checking if the given file is a test or not in jdtls. It's `java.project.isTestFile`. However calling this has to be done asynchronously. So my adapter function should look like this with a callback function. But looking at the interface there is not? So how should this be handled?
```lua
adapter.is_test_file = function(file_path, callback)
jdtls.executeCommand({
command = 'java.project.isTestFile',
arguments = { uri },
}, function(err, is_test_file)
assert(err, 'could not check the file')
callback(is_test_file)
end)
end
```
- What should `build_spec` return? Is it a dap laucher config?
Discussed in https://github.com/nvim-neotest/neotest/discussions/322