first unit-test v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 15 Dec 2013 22:54:29 +0100
branchv_0
changeset 6c79a5b030e99
parent 5 26223eb63851
child 7 a7555ec6eea9
first unit-test
java/sql-dk/nbproject/project.properties
java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java
     1.1 --- a/java/sql-dk/nbproject/project.properties	Sun Dec 15 22:44:11 2013 +0100
     1.2 +++ b/java/sql-dk/nbproject/project.properties	Sun Dec 15 22:54:29 2013 +0100
     1.3 @@ -37,7 +37,8 @@
     1.4  javac.target=1.7
     1.5  javac.test.classpath=\
     1.6      ${javac.classpath}:\
     1.7 -    ${build.classes.dir}
     1.8 +    ${build.classes.dir}:\
     1.9 +    ${libs.testng.classpath}
    1.10  javac.test.processorpath=\
    1.11      ${javac.test.classpath}
    1.12  javadoc.additionalparam=
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java	Sun Dec 15 22:54:29 2013 +0100
     2.3 @@ -0,0 +1,32 @@
     2.4 +package info.globalcode.sql.dk;
     2.5 +
     2.6 +import info.globalcode.sql.dk.CLIParser.Tokens;
     2.7 +import static org.testng.Assert.*;
     2.8 +import org.testng.annotations.BeforeMethod;
     2.9 +import org.testng.annotations.Test;
    2.10 +
    2.11 +/**
    2.12 + *
    2.13 + * @author Ing. František Kučera (frantovo.cz)
    2.14 + */
    2.15 +public class CLIParserTest {
    2.16 +
    2.17 +	public static final String DATABASE_NAME_1 = "some database 1";
    2.18 +	public static final String SQL_1 = "SELECT * FROM table1";
    2.19 +	private CLIParser parser;
    2.20 +
    2.21 +	@BeforeMethod
    2.22 +	public void setUpMethod() throws Exception {
    2.23 +		parser = new CLIParser();
    2.24 +	}
    2.25 +
    2.26 +	@Test
    2.27 +	public void testParseOptions() throws InvalidOptionsException {
    2.28 +		String[] args = new String[]{Tokens.DB, DATABASE_NAME_1, Tokens.SQL, SQL_1};
    2.29 +		CLIOptions options = parser.parseOptions(args);
    2.30 +		options.validate();
    2.31 +
    2.32 +		assertEquals(options.getDatabaseName(), DATABASE_NAME_1);
    2.33 +		assertEquals(options.getSql(), SQL_1);
    2.34 +	}
    2.35 +}
    2.36 \ No newline at end of file