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