db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1330202 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UniqueConstraintSetNullTest.java
Date Wed, 25 Apr 2012 11:21:09 GMT
Author: kahatlen
Date: Wed Apr 25 11:21:09 2012
New Revision: 1330202

URL: http://svn.apache.org/viewvc?rev=1330202&view=rev
Log:
DERBY-5718: UniqueConstraintSetNullTest calls super.tearDown() too early

Call super.tearDown() last in tearDown(), and use framework helper methods
in setUp() and tearDown() to simplify and make resources freed automatically.

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UniqueConstraintSetNullTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UniqueConstraintSetNullTest.java?rev=1330202&r1=1330201&r2=1330202&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UniqueConstraintSetNullTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UniqueConstraintSetNullTest.java
Wed Apr 25 11:21:09 2012
@@ -21,18 +21,12 @@
 
 package org.apache.derbyTesting.functionTests.tests.lang;
 
-import java.sql.Connection;
 import java.sql.PreparedStatement;
-import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.Savepoint;
 import java.sql.Statement;
 import java.sql.Types;
-import java.util.Enumeration;
 
 import junit.framework.Test;
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
 import junit.framework.TestSuite;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
@@ -67,19 +61,16 @@ public class UniqueConstraintSetNullTest
      * Create table for test cases to use.
      */
     protected void setUp() throws Exception {
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
+        Statement stmt = createStatement();
         stmt.executeUpdate("create table constraintest (" +
                 "val1 varchar (20) not null, " +
                 "val2 varchar (20))");
     }
     
     protected void tearDown() throws Exception {
+        dropTable("constraintest");
+        commit();
         super.tearDown();
-        Connection con = getConnection();
-        Statement stmt = con.createStatement();
-        stmt.executeUpdate("drop table constraintest");
-        con.commit();
     }
     /**
      * Test the behaviour of unique constraint after making



Mime
View raw message