01: package liquibase.database.sql;
02:
03: import liquibase.database.Database;
04: import liquibase.test.DatabaseTest;
05: import liquibase.test.DatabaseTestTemplate;
06: import static org.junit.Assert.*;
07: import org.junit.Test;
08:
09: public class RawSqlStatementTest extends AbstractSqlStatementTest {
10:
11: protected SqlStatement generateTestStatement() {
12: return new RawSqlStatement(null);
13: }
14:
15: protected void setupDatabase(Database database) throws Exception {
16: ; //nothing to set up
17: }
18:
19: @Test
20: public void constructorWithNoDelimiterPassed() throws Exception {
21: new DatabaseTestTemplate()
22: .testOnAllDatabases(new DatabaseTest() {
23: public void performTest(Database database) {
24: RawSqlStatement statement = new RawSqlStatement(
25: "statement here");
26: assertEquals(";", statement
27: .getEndDelimiter(database));
28: }
29: });
30: }
31:
32: @Test
33: public void constructor() throws Exception {
34: new DatabaseTestTemplate()
35: .testOnAllDatabases(new DatabaseTest() {
36: public void performTest(Database database) {
37: RawSqlStatement statement = new RawSqlStatement(
38: "statement here");
39: assertEquals("statement here", statement
40: .getSqlStatement(database));
41: }
42: });
43: }
44:
45: @Test
46: public void constructorWithDelimiterPassed() throws Exception {
47: new DatabaseTestTemplate()
48: .testOnAllDatabases(new DatabaseTest() {
49: public void performTest(Database database) {
50: RawSqlStatement statement = new RawSqlStatement(
51: "statement here", "GO\n");
52: assertEquals("GO\n", statement
53: .getEndDelimiter(database));
54: }
55: });
56: }
57:
58: @Test
59: public void testToString() throws Exception {
60: new DatabaseTestTemplate()
61: .testOnAllDatabases(new DatabaseTest() {
62: public void performTest(Database database) {
63: RawSqlStatement statement = new RawSqlStatement(
64: "statement here");
65: assertEquals("statement here", statement
66: .toString());
67: }
68: });
69: }
70: }
|