/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.util.db;

import static org.testng.AssertJUnit.assertEquals;

import org.testng.annotations.Test;

/**
 * Test HSQLDbHelper.
 */
@Test
public class HSQLDbHelperTest extends DbHelperTest {

  public HSQLDbHelperTest() {
    _helper = HSQLDbHelper.INSTANCE;
  }

  //-------------------------------------------------------------------------
  public void test_getJDBCDriver() {
    assertEquals(org.hsqldb.jdbcDriver.class, _helper.getJDBCDriverClass());
  }

  public void test_getHibernateDialect() {
    assertEquals(org.hibernate.dialect.HSQLDialect.class, _helper.getHibernateDialect().getClass());
  }

  public void test_getName() {
    assertEquals("HSQL", _helper.getName());
  }

  //-------------------------------------------------------------------------
  public void test_sqlNextSequenceValueSelect() {
    assertEquals("CALL NEXT VALUE FOR MySeq", _helper.sqlNextSequenceValueSelect("MySeq"));
  }

}

@@ -1064,12 +1064,1017 @@
 %22));%0A  %7D
+%0A  %0A  //-------------------------------------------------------------------------%0A  public void test_sqlWildcardQuery() %7B%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22a*%22));%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22a?%22));%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22a*b%22));%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22a?b%22));%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22*b%22));%0A    assertEquals(%22AND col LIKE :arg ESCAPE '%5C%5C' %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22?b%22));%0A    %0A    assertEquals(%22AND col = :arg %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22a%22));%0A    assertEquals(%22AND col = :arg %22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, %22%22));%0A    assertEquals(%22%22, _helper.sqlWildcardQuery(%22AND col %22, %22:arg%22, null));%0A  %7D
 %0A%0A%7D%0A

test for HSQLDb escape clause