SQL query testing with Java