### Question:
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private  TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
			DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
			boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig);  }### Answer:
@Test public void testDropTable() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
@Test(expected = SQLException.class) public void testDropTableThrow() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, true, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
@Test public void testDropTableThrowIgnore() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, true, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, true); } }); }
@Test(expected = SQLException.class) public void testDropTableNegRows() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, -1, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
@Test public void testDropTableTableConfig() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, DatabaseTableConfig.fromClass(connectionSource, LocalFoo.class), false); } }); }
@Test public void testDropThenQuery() throws Exception { Dao<LocalFoo, Integer> fooDao = createDao(LocalFoo.class, true); assertEquals(0, fooDao.queryForAll().size()); dropTable(LocalFoo.class, true); try { fooDao.queryForAll(); fail("Should have thrown"); } catch (SQLException e) { } }