You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2008/02/01 22:39:42 UTC
svn commit: r617661 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Author: djd
Date: Fri Feb 1 13:39:38 2008
New Revision: 617661
URL: http://svn.apache.org/viewvc?rev=617661&view=rev
Log:
Minor cleanup in TableFunctionTest to not catch exceptions that indicate failure and report them with a fail message. This is not required, an uncaught exception will cause the test to fail anyway, and it makes debugging harder as the stack trace of the failure is lost
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=617661&r1=617660&r2=617661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java Fri Feb 1 13:39:38 2008
@@ -1591,7 +1591,6 @@
{
println( "\nExpecting good results from " + sql );
- try {
PreparedStatement ps = prepareStatement( sql );
ResultSet rs = ps.executeQuery();
@@ -1599,11 +1598,7 @@
rs.close();
ps.close();
- }
- catch (Exception e)
- {
- unexpectedThrowable( e );
- }
+
}
/**
@@ -1618,19 +1613,15 @@
/**
* Run good DDL.
+ * @throws SQLException
*/
- private void goodStatement( String ddl )
+ private void goodStatement( String ddl ) throws SQLException
{
- try {
PreparedStatement ps = chattyPrepare( ddl );
ps.execute();
ps.close();
- }
- catch (Exception e)
- {
- unexpectedThrowable( e );
- }
+
}
/**
@@ -1646,32 +1637,17 @@
/**
* Verify that the return type of function looks good.
+ * @throws SQLException
*/
- private void verifyReturnType( String functionName, String expectedReturnType )
+ private void verifyReturnType( String functionName, String expectedReturnType ) throws SQLException
{
println( functionName + " should have return type = " + expectedReturnType );
- try {
- String ddl = "select aliasinfo from sys.sysaliases where alias=?";
- PreparedStatement ps = prepareStatement( ddl );
-
- ps.setString( 1, functionName );
-
- ResultSet rs = ps.executeQuery();
-
- rs.next();
-
- String actualReturnType = rs.getString( 1 );
+ String ddl = "select aliasinfo from sys.sysaliases where alias=?";
+ PreparedStatement ps = prepareStatement(ddl);
+ ps.setString(1, functionName);
- assertTrue( expectedReturnType.equals( actualReturnType ) );
-
- rs.close();
- ps.close();
- }
- catch (Exception e)
- {
- unexpectedThrowable( e );
- }
+ JDBC.assertSingleValueResultSet(ps.executeQuery(), expectedReturnType);
}
/**
@@ -1685,7 +1661,7 @@
// JDBC4 metadata calls.
if ( usingDerbyNet() ) { return; }
- try {
+
println( "\nExpecting correct function metadata from " + functionName );
ResultSet rs = getFunctions( null, "APP", functionName );
JDBC.assertFullResultSet( rs, expectedGetFunctionsResult, false );
@@ -1696,11 +1672,6 @@
//prettyPrint( getConnection(), getFunctionColumns( null, "APP", functionName, "%" ) );
JDBC.assertFullResultSet( rs, expectedGetFunctionColumnsResult, false );
rs.close();
- }
- catch (Exception e)
- {
- unexpectedThrowable( e );
- }
}
/**
@@ -1982,15 +1953,6 @@
return new String( bytes, UTF8 );
}
else { return obj.toString(); }
- }
-
- /**
- * Fail the test for an unexpected exception
- */
- private void unexpectedThrowable( Throwable t )
- {
- printStackTrace( t );
- fail( "Unexpected exception: " + t );
}
/**