@Test
public void testConvertQuotedSqlWithEscape() throws SQLException {

    DataSourceDefProvider provider = DataSourceDefProvider.getInstance();
    ConvMaster master = new ConvMaster(provider.getDefault(), provider.getById(TEST_TARGET));
    SqlConverter converter = new SqlConverter(new SqlConverter.IConfigurer() {
        @Override
        public boolean skipDefaultConvert() {
            return false;
        }
        @Override
        public boolean skipHandleDefault() {
            return false;
        }
        @Override
        public boolean useUppercaseDefault() {
            return true;
        }
        @Override
        public String fixAfterDefaultConvert(String orig) {
            return orig;
        }
        @Override
        public SqlDialect getSqlDialect() {
            return SqlDialect.CALCITE;
        }
        @Override
        public boolean allowNoOffset() {
            return true;
        }
        @Override
        public boolean allowFetchNoRows() {
            return true;
        }
        @Override
        public boolean allowNoOrderByWithFetch() {
            return true;
        }
        @Override
        public String getPagingType() {
            return "AUTO";
        }
        @Override
        public boolean isCaseSensitive() {
            return false;
        }
        @Override
        public boolean enableCache() {
            return true;
        }
        @Override
        public boolean enableQuote() {
            return true;
        }
        @Override
        public String fixIdentifierCaseSensitve(String orig) {
            return orig;
        }
        @Override
        public String getTransactionIsolationLevel() {
            return null;
        }
    }, master);
    Assert.assertEquals("SELECT SUM(\"A\"), COUNT(\"A\") AS \"AB\"\nFROM \"DEFAULT\".\"CUBE\"",
            converter.convertSql("select sum(A), count(`A`) as AB from DEFAULT.`CUBE`"));
    Assert.assertEquals("SELECT A(), B(\"A\"), CAST(\"PRICE@@\" AS DDD)\nFROM \"DEFAULT\".\"CUBE\"",
            converter.convertSql("select A(), B(`A`), cast(`PRICE@@` as `DDD`) from DEFAULT.`CUBE`"));
    Assert.assertEquals("SELECT A(), B(\"A\"), CAST(\"PRICE@@\" AS DDD)\nFROM \"DEFAULT\".\"CUBE\"",
            converter.convertSql("select A(), B(\"A\"), cast(\"PRICE@@\" as \"DDD\") from \"DEFAULT\".\"CUBE\""));
    Assert.assertEquals(
            "SELECT \"kylin_sales\".\"price_@@\", \"kylin_sales\".\"count\"\nFROM \"cube\".\"kylin_sales\"\nWHERE \"kylin_sales\".\"price_@@\" > 1 AND \"kylin_sales\".\"count\" < 50",
            converter.convertSql(
                    "select `kylin_sales`.`price_@@`, `kylin_sales`.`count` from `cube`.`kylin_sales` where `kylin_sales`.`price_@@` > 1 and `kylin_sales`.`count` < 50"));
    Assert.assertEquals("SELECT COUNT(DISTINCT \"price_#@\")\nFROM \"cube\".\"kylin_sales\"",
            converter.convertSql("select count(distinct `price_#@`) from `cube`.`kylin_sales`"));
}