use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_twoGenerators_noErrors.
@Test
public void validate_twoGenerators_noErrors() {
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);
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 validate_twoGenerators_firstHasErrors.
@Test
public void validate_twoGenerators_firstHasErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2").addValidationError("E1"));
generators.add(new MockSqlGenerator(1, "A1", "A2"));
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 generateSql_threeGenerators.
@Test
public void generateSql_threeGenerators() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
generators.add(new MockSqlGenerator(2, "B1", "B2"));
generators.add(new MockSqlGenerator(1, "A1", "A2"));
generators.add(new MockSqlGenerator(3, "C1", "C2"));
SqlGeneratorChain chain = new SqlGeneratorChain(generators);
Sql[] sql = chain.generateSql(new MockSqlStatement(), new MockDatabase());
assertEquals(6, sql.length);
assertEquals("C1", sql[0].toSql());
assertEquals("C2", sql[1].toSql());
assertEquals("B1", sql[2].toSql());
assertEquals("B2", sql[3].toSql());
assertEquals("A1", sql[4].toSql());
assertEquals("A2", sql[5].toSql());
}
use of liquibase.statement.core.MockSqlStatement in project liquibase by liquibase.
the class SqlGeneratorChainTest method validate_oneGenerators_hasErrors.
@Test
public void validate_oneGenerators_hasErrors() {
SortedSet<SqlGenerator> generators = new TreeSet<SqlGenerator>(new SqlGeneratorComparator());
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_nullGenerators.
@Test
public void validate_nullGenerators() {
SqlGeneratorChain chain = new SqlGeneratorChain(null);
ValidationErrors validationErrors = chain.validate(new MockSqlStatement(), new MockDatabase());
assertFalse(validationErrors.hasErrors());
}
Aggregations