@Test
public void testDropTables() throws Exception {

    // Mock SQL objects
    final Statement statement = Mockito.mock(Statement.class);
    Mockito.when(statement.execute(Mockito.anyString())).then(invocation -> {
        final String sql = (String) invocation.getArguments()[0];
        if (sql.startsWith("DROP TABLE IF EXISTS `invalid`")) {
            throw new SQLException();
        }
        return true;
    });
    final Connection connection = Mockito.mock(Connection.class);
    Mockito.when(connection.createStatement()).thenReturn(statement);
    // Test dropping tables with success
    TableRegisterSupport support = new TableRegisterSupport(connection);
    Assert.assertTrue(support.dropTables("cat", "feed", EnumSet.of(TableType.MASTER, TableType.VALID, TableType.INVALID), ImmutableSet.of("backup.feed")));
    Mockito.verify(statement).execute("DROP TABLE IF EXISTS `cat`.`feed`");
    Mockito.verify(statement).execute("DROP TABLE IF EXISTS `cat`.`feed_valid`");
    Mockito.verify(statement).execute("DROP TABLE IF EXISTS `cat`.`feed_invalid`");
    Mockito.verify(statement).execute("DROP TABLE IF EXISTS backup.feed");
    // Test dropping tables with exception
    Assert.assertFalse(support.dropTables("invalid", "feed", EnumSet.allOf(TableType.class), ImmutableSet.of()));
    Assert.assertFalse(support.dropTables("cat", "feed", ImmutableSet.of(), ImmutableSet.of("`invalid`")));
}