The project in question runs on Hibernate 5.4 for persistence, against MySQL when deployed. Unit tests are ran during the Maven build.
I'm in the process of doing a feel-faster optimization. As such, I now have 2 methods:
the original one. Takes a long time, returns a list of trees (in the form of a root node with more nodes linked)
the new one. Should return a list of just the root nodes, i.e. no more nodes linked
Unfortunately, due to the logic in the original method, I had to use recursion in the database. As Java persistence api apparently does not support this, I had to use native SQL, I chose to use
WITH RECURSIVE specifically to deal with my problem.
Now I'd love to unit-test the two methods for returning the same root nodes. Other tests we have use a H2 in-memory database that is designed for test, unfortunately going by http://www.h2database.com/html/grammar.html it doesn't appear to support recursion in any form.
I'm wondering if there's anything short of running an actual mysql instance that I could do to unit test this.
Another thing I could try would be hooking into our CI/CD in a phase post-build, which attempts to install the package built by the build step. So far, however, there are no tests running in this phase (the thing being tested is installability), and I'd have to access both methods via GoogleWebToolkit remote calls, which sounds problematic at best, and should be unnecessary testing-wise since both are backend methods and using RPC's just ads another layer over the things being tested.