Context and Justification
So I'm writing tests for a projects where the methods require JSON as input, but since there's no good way of writing inline JSON in Java, I want to include my test case JSON as a .json file that can be loaded when the tests are run. The most logical place for these JSON files is in the same directory as where the corresponding test belongs, so that the grouping of the tests and their JSON is clear. The only problem with this is that I can't find a good way to load in these JSON files without hard-coding their address. As such, the question follows:
Question
How can I programmatically determine the directory of the current Java file, so that I can then use that directory to load in files contained within it? Note that I don't want to find the current working directory of the program, since that may not match the directory where my tests are contained.
Thanks heaps!