db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r608688 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java
Date Fri, 04 Jan 2008 00:25:57 GMT
Author: djd
Date: Thu Jan  3 16:25:55 2008
New Revision: 608688

URL: http://svn.apache.org/viewvc?rev=608688&view=rev
Log:
Clean up CommentTest to not use a field to hold a Statement object (no need).
Also to use assertCompileError() instead of assertCallError() since that's actually what it
being tested (a compile failure). This meant checking for the correct SQL state, not an incorrect
one, this was previously hidden by a bug in assertCallError().

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java?rev=608688&r1=608687&r2=608688&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CommentTest.java
Thu Jan  3 16:25:55 2008
@@ -40,7 +40,6 @@
  * Test for comments.
  */
 public final class CommentTest extends BaseJDBCTestCase {
-    private Statement stmt;
 
     /**
      * Public constructor required for running test as standalone JUnit.
@@ -63,6 +62,8 @@
      */
     public void testBracketedComments() throws Exception
     {
+        Statement stmt = createStatement();
+        
         JDBC.assertFullResultSet(
             stmt.executeQuery("/* a comment */ VALUES 1"), 
             new String [][] {{"1"}});
@@ -121,10 +122,10 @@
             new String [][] {{"/* a comment \n-- */"}});
 
         // unterminated comments generate lexical errors
-        assertCallError("42X03", getConnection(), "VALUES 1 /*");
-        assertCallError("42X03", getConnection(), "VALUES 1 /* comment");
-        assertCallError("42X03", getConnection(), "VALUES 1 /* comment /*");
-        assertCallError("42X03", getConnection(), "VALUES 1 /* comment /* nested */");
+        assertCompileError("42X02", "VALUES 1 /*");
+        assertCompileError("42X02", "VALUES 1 /* comment");
+        assertCompileError("42X02", "VALUES 1 /* comment /*");
+        assertCompileError("42X02", "VALUES 1 /* comment /* nested */");
 
         // just comments generates syntax error
         assertCompileError("42X01", "/* this is a comment */");
@@ -132,20 +133,10 @@
     }
     
     /**
-     * Set the fixture up.
+     * Default connections to auto-commit false.
      */
-    protected void setUp() throws SQLException
+    protected void initializeConnection(Connection conn) throws SQLException
     {    
-        getConnection().setAutoCommit(false);
-        stmt = createStatement();
-    }
-    
-    /**
-     * Tear-down the fixture.
-     */
-    protected void tearDown() throws Exception
-    {
-        stmt.close();
-        super.tearDown();
+        conn.setAutoCommit(false);
     }
 }



Mime
View raw message