JDocCoverage Report - 21.04.2006 22:02:51

Namemethod, %comment, %TODO@see
smallsql.junit.TestExceptionMethods14,8%   (113/2243)100

/* =============================================================
 * SmallSQL : a free Java DBMS library for the Java(tm) platform
 * =============================================================
 *
 * (C) Copyright 2004-2006, by Volker Berlin.
 *
 * Project Info:  http://www.smallsql.de/
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2.1 of the License, or 
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * ---------------
 * TestExceptionMethods.java
 * ---------------
 * Author: Volker Berlin
 * 
 * Created on 02.03.2005
 */
package smallsql.junit;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author Volker Berlin
 */
public class TestExceptionMethods extends BasicTestCase {

	public void testForwardOnly() throws Exception{
		Connection con = AllTests.getConnection();
		try{			
			con.createStatement().execute("Create Table ExceptionMethods(v varchar(30))");

			con.createStatement().execute("Insert Into ExceptionMethods(v) Values('qwert')");

			ResultSet rs = con.createStatement().executeQuery("Select * from ExceptionMethods");			
			assertEquals( true, rs.next() );
			
			try{
				rs.isBeforeFirst();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}

			try{
				rs.isFirst();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}

			try{
				rs.first();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}

			try{
				rs.previous();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}

			try{
				rs.last();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}
			
			try{
				rs.isLast();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}
			
			try{
				rs.isAfterLast();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}
			
			try{
				rs.afterLast();
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}
			
			try{
				rs.absolute(1);
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}
			
			try{
				rs.relative(1);
				fail("SQLException 'ResultSet is forward only' should be throw");
			}catch(SQLException e){
				//TODO check error code of "ResultSet is forward only"
			}


		}finally{
			try{
				con.createStatement().execute("Drop Table ExceptionMethods");
			}catch(Throwable e){}
		}
	}

}