java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 15 Dec 2013 22:54:29 +0100
branchv_0
changeset 6 c79a5b030e99
child 7 a7555ec6eea9
permissions -rw-r--r--
first unit-test
     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 }