@@ -0,0 +1,1820 @@
+package org.flymine.util;%0A%0Aimport junit.framework.*;%0A%0Aimport java.sql.Connection;%0Aimport org.flymine.sql.ConnectionFactory;%0A%0Apublic class DatabaseUtilTest extends TestCase%0A%7B%0A    private Connection con;%0A%0A    public DatabaseUtilTest(String arg1) %7B%0A        super(arg1);%0A    %7D%0A%0A    public void setUp() throws Exception %7B%0A        con = ConnectionFactory.getConnection(%22db.unittest%22);%0A    %7D%0A%0A    public void tearDown() throws Exception %7B%0A        con.close();%0A    %7D%0A%0A    protected void createTable() throws Exception %7B%0A        con.createStatement().execute(%22CREATE TABLE table1(col1 int)%22);%0A        con.commit();%0A    %7D%0A%0A    protected void dropTable() throws Exception %7B%0A        con.createStatement().execute(%22DROP TABLE table1%22);%0A        con.commit();%0A    %7D%0A%0A    public void testTableExistsNullConnection() throws Exception %7B%0A        try %7B%0A            DatabaseUtil.tableExists(null, %22table1%22);%0A            fail(%22Expected: NullPointerException%22);%0A        %7D%0A        catch (NullPointerException e) %7B%0A        %7D%0A    %7D%0A%0A    public void testTableExistsNullTable() throws Exception %7B%0A        try %7B%0A            DatabaseUtil.tableExists(ConnectionFactory.getConnection(%22db.unittest%22), null);%0A            fail(%22Expected: NullPointerException%22);%0A        %7D%0A        catch (NullPointerException e) %7B%0A        %7D%0A    %7D%0A%0A    public void testTableExists() throws Exception %7B%0A        synchronized (con) %7B%0A            createTable();%0A            assertTrue(DatabaseUtil.tableExists(ConnectionFactory.getConnection(%22db.unittest%22), %22table1%22));%0A            dropTable();%0A        %7D%0A    %7D%0A%0A    public void testTableNotExists() throws Exception %7B%0A        synchronized (con) %7B%0A            createTable();%0A            assertTrue(!(DatabaseUtil.tableExists(ConnectionFactory.getConnection(%22db.unittest%22), %22table2%22)));%0A            dropTable();%0A        %7D%0A    %7D%0A%7D%0A

Test class for DatabaseUtil