use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_twoGenerators_secondHasErrors.
@Test
public void validate_twoGenerators_secondHasErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2"));
generators.add(new MockSqlGenerator(1, "A1", "A2").addValidationError("E1"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
assertTrue(validationErrors.hasErrors());
}
use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_oneGenerators_noErrors.
@Test
public void validate_oneGenerators_noErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(1, "A1", "A2"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
assertFalse(validationErrors.hasErrors());
}
use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method generateSql_oneGenerators.
@Test
public void generateSql_oneGenerators() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(1, "A1", "A2"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
assertEquals(2, sql.length);
assertEquals("A1", sql[0].toSql());
assertEquals("A2", sql[1].toSql());
}
use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method generateSql_noGenerators.
@Test
public void generateSql_noGenerators() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
assertEquals(0, chain.generateSql(new MockSqlStatement(), new MockDatabase()).length);
}
use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method generateSql_twoGenerators.
@Test
public void generateSql_twoGenerators() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2"));
generators.add(new MockSqlGenerator(1, "A1", "A2"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
assertEquals(4, sql.length);
assertEquals("B1", sql[0].toSql());
assertEquals("B2", sql[1].toSql());
assertEquals("A1", sql[2].toSql());
assertEquals("A2", sql[3].toSql());
}
Aggregations