content: package com.alibaba.druid.bvt.pool;
  
  import com.alibaba.druid.mock.MockConnection;
  import com.alibaba.druid.pool.DruidDataSource;
  import junit.framework.TestCase;
  
  import java.sql.Connection;
  import java.util.ArrayList;
  import java.util.List;
  
  public class DruidDataSourceTest_initSql extends TestCase {
      private DruidDataSource dataSource;
  
      protected void setUp() throws Exception {
          dataSource = new DruidDataSource();
          dataSource.setUrl("jdbc:mock:xxx");
          List<Object> sqlList = new ArrayList<Object>();
          sqlList.add("select 123");
          sqlList.add(null);
          sqlList.add("");
  
          dataSource.setConnectionInitSqls(sqlList);
      }
  
      protected void tearDown() throws Exception {
          dataSource.close();
      }
  
      public void testDefault() throws Exception {
          Connection conn = dataSource.getConnection();
  
          MockConnection mockConn = conn.unwrap(MockConnection.class);
  
          assertEquals("select 123", mockConn.getLastSql());
  
          conn.close();
      }
  }
  