Attaching a patch that makes two changes to the test:
1) It adds a tearDown() method that closes the statements and clears the references to them.
2) This is a data-driven test. However, the test inputs are stored in non-static variables, so they are duplicated in memory as many times as there are test cases. The patch makes the variables that hold the test input static to reduce the memory footprint of the test.