franta-hg@6: package info.globalcode.sql.dk; franta-hg@6: franta-hg@6: import info.globalcode.sql.dk.CLIParser.Tokens; franta-hg@6: import static org.testng.Assert.*; franta-hg@6: import org.testng.annotations.BeforeMethod; franta-hg@6: import org.testng.annotations.Test; franta-hg@6: franta-hg@6: /** franta-hg@6: * franta-hg@6: * @author Ing. František Kučera (frantovo.cz) franta-hg@6: */ franta-hg@6: public class CLIParserTest { franta-hg@6: franta-hg@6: public static final String DATABASE_NAME_1 = "some database 1"; franta-hg@6: public static final String SQL_1 = "SELECT * FROM table1"; franta-hg@6: private CLIParser parser; franta-hg@6: franta-hg@6: @BeforeMethod franta-hg@6: public void setUpMethod() throws Exception { franta-hg@6: parser = new CLIParser(); franta-hg@6: } franta-hg@6: franta-hg@6: @Test franta-hg@6: public void testParseOptions() throws InvalidOptionsException { franta-hg@6: String[] args = new String[]{Tokens.DB, DATABASE_NAME_1, Tokens.SQL, SQL_1}; franta-hg@6: CLIOptions options = parser.parseOptions(args); franta-hg@6: options.validate(); franta-hg@6: franta-hg@6: assertEquals(options.getDatabaseName(), DATABASE_NAME_1); franta-hg@6: assertEquals(options.getSql(), SQL_1); franta-hg@6: } franta-hg@6: }