equal
deleted
inserted
replaced
|
1 package info.globalcode.sql.dk; |
|
2 |
|
3 import info.globalcode.sql.dk.CLIParser.Tokens; |
|
4 import static org.testng.Assert.*; |
|
5 import org.testng.annotations.BeforeMethod; |
|
6 import org.testng.annotations.Test; |
|
7 |
|
8 /** |
|
9 * |
|
10 * @author Ing. František Kučera (frantovo.cz) |
|
11 */ |
|
12 public class CLIParserTest { |
|
13 |
|
14 public static final String DATABASE_NAME_1 = "some database 1"; |
|
15 public static final String SQL_1 = "SELECT * FROM table1"; |
|
16 private CLIParser parser; |
|
17 |
|
18 @BeforeMethod |
|
19 public void setUpMethod() throws Exception { |
|
20 parser = new CLIParser(); |
|
21 } |
|
22 |
|
23 @Test |
|
24 public void testParseOptions() throws InvalidOptionsException { |
|
25 String[] args = new String[]{Tokens.DB, DATABASE_NAME_1, Tokens.SQL, SQL_1}; |
|
26 CLIOptions options = parser.parseOptions(args); |
|
27 options.validate(); |
|
28 |
|
29 assertEquals(options.getDatabaseName(), DATABASE_NAME_1); |
|
30 assertEquals(options.getSql(), SQL_1); |
|
31 } |
|
32 } |