java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java
branchv_0
changeset 6 c79a5b030e99
child 7 a7555ec6eea9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java	Sun Dec 15 22:54:29 2013 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +package info.globalcode.sql.dk;
     1.5 +
     1.6 +import info.globalcode.sql.dk.CLIParser.Tokens;
     1.7 +import static org.testng.Assert.*;
     1.8 +import org.testng.annotations.BeforeMethod;
     1.9 +import org.testng.annotations.Test;
    1.10 +
    1.11 +/**
    1.12 + *
    1.13 + * @author Ing. František Kučera (frantovo.cz)
    1.14 + */
    1.15 +public class CLIParserTest {
    1.16 +
    1.17 +	public static final String DATABASE_NAME_1 = "some database 1";
    1.18 +	public static final String SQL_1 = "SELECT * FROM table1";
    1.19 +	private CLIParser parser;
    1.20 +
    1.21 +	@BeforeMethod
    1.22 +	public void setUpMethod() throws Exception {
    1.23 +		parser = new CLIParser();
    1.24 +	}
    1.25 +
    1.26 +	@Test
    1.27 +	public void testParseOptions() throws InvalidOptionsException {
    1.28 +		String[] args = new String[]{Tokens.DB, DATABASE_NAME_1, Tokens.SQL, SQL_1};
    1.29 +		CLIOptions options = parser.parseOptions(args);
    1.30 +		options.validate();
    1.31 +
    1.32 +		assertEquals(options.getDatabaseName(), DATABASE_NAME_1);
    1.33 +		assertEquals(options.getSql(), SQL_1);
    1.34 +	}
    1.35 +}
    1.36 \ No newline at end of file