Parametrized number of tests and last query in Java