View Javadoc
1 /* 2 CsvJdbc - a JDBC driver for CSV files 3 Copyright (C) 2001 Jonathan Ackerman 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 package test.org.relique.jdbc.csv; 20 21 import org.relique.jdbc.csv.SqlParser; 22 import junit.framework.*; 23 24 /***This class is used to test the SqlParser class. 25 * 26 * @author Jonathan Ackerman 27 * @version $Id: TestSqlParser.html,v 1.1 2003/05/12 16:19:47 sinisa Exp $ 28 */ 29 public class TestSqlParser extends TestCase 30 { 31 public TestSqlParser(String name) 32 { 33 super(name); 34 } 35 36 public void testParser() 37 { 38 try 39 { 40 SqlParser parser = new SqlParser(); 41 42 parser.parse("SELECT FLD_A,FLD_B, TEST, H FROM test"); 43 assertTrue("Incorrect table name",parser.getTableName().equals("test")); 44 45 String[] cols = parser.getColumnNames(); 46 assertTrue("Incorrect Column Count",cols.length==4); 47 48 assertTrue("Incorrect Column Name Col 0",cols[0].equals("FLD_A")); 49 assertTrue("Incorrect Column Name Col 1",cols[1].equals("FLD_B")); 50 assertTrue("Incorrect Column Name Col 2",cols[2].equals("TEST")); 51 assertTrue("Incorrect Column Name Col 3",cols[3].equals("H")); 52 53 } 54 catch(Exception e) 55 { 56 fail("Unexpected Exception:" + e); 57 } 58 } 59 }

This page automatically generated by Maven