I have two independent JUnit tests that use IDatabaseTester to load schema, then data from an XML.
When run individually, all goes well. But when run in succession, the second JUnit test fails because "the TABLE name already exists".
I have tracked it to the fact that the HSQLDB database is attempted to be loaded twice. Of course it would fail in the second time.
I looked at the IDatabaseTester definition and while there are methods to set the database, I could not find one to "unset" it.
What is the proper way to unload it?
Answering own question, in case it helps someone else:
import org.apache.ddlutils.Platform;
import java.sql.Connection;
import org.apache.ddlutils.model.Database;
Platform platform = PlatformFactory.createNewPlatformInstance(HSQLDB_JDBC_DRIVER, HSQLDB_JDBC_URL);
Database database = jdbcModelReader.getDatabase(hsqldbConnection, null);
platform.dropTables(database, true);