01: /*
02: * TableStatementsTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.importer;
13:
14: import junit.framework.TestCase;
15: import workbench.db.TableIdentifier;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class TableStatementsTest extends TestCase {
22: public TableStatementsTest(String testName) {
23: super (testName);
24: }
25:
26: public void testGetTableStatement() {
27: TableIdentifier tbl = new TableIdentifier("tsch", "address");
28:
29: TableStatements stmt = new TableStatements(
30: "delete from ${table.name}", null);
31: String sql = stmt.getPreStatement(tbl);
32: assertEquals("delete from address", sql);
33: assertNull(stmt.getPostStatement(tbl));
34:
35: stmt = new TableStatements(
36: "set identity insert ${table.expression} on",
37: "set identity insert ${table.expression} off");
38: assertEquals("set identity insert tsch.address on", stmt
39: .getPreStatement(tbl));
40: assertEquals("set identity insert tsch.address off", stmt
41: .getPostStatement(tbl));
42:
43: }
44: }
|