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 ka...@apache.org on 2012/05/23 12:04:32 UTC

svn commit: r1341814 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java junit/BaseJDBCTestCase.java

Author: kahatlen
Date: Wed May 23 10:04:32 2012
New Revision: 1341814

URL: http://svn.apache.org/viewvc?rev=1341814&view=rev
Log:
DERBY-5771: Use TestNullOutputStream where possible

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java?rev=1341814&r1=1341813&r2=1341814&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/Utf8CcsidManagerClientTest.java Wed May 23 10:04:32 2012
@@ -21,8 +21,6 @@
 
 package org.apache.derbyTesting.functionTests.tests.derbynet;
 
-import java.io.IOException;
-import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
@@ -35,6 +33,7 @@ import org.apache.derby.client.am.LogWri
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.net.NetAgent;
 import org.apache.derby.client.net.Utf8CcsidManager;
+import org.apache.derbyTesting.functionTests.util.TestNullOutputStream;
 import org.apache.derbyTesting.junit.BaseTestCase;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -51,11 +50,7 @@ public class Utf8CcsidManagerClientTest 
 
         // Set up a dummy Agent since many of the methods require one for
         // generating exceptions.
-        PrintWriter pw = new PrintWriter(new OutputStream() {
-            public void write(int b) throws IOException {
-                // Everything goes to /dev/null...
-            }
-        });
+        PrintWriter pw = new PrintWriter(new TestNullOutputStream());
         agent = new NetAgent(null, new LogWriter(pw, 0));
     }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?rev=1341814&r1=1341813&r2=1341814&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Wed May 23 10:04:32 2012
@@ -44,6 +44,7 @@ import org.apache.derby.iapi.sql.execute
 import org.apache.derby.impl.jdbc.EmbedConnection;
 import org.apache.derby.tools.ij;
 import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
+import org.apache.derbyTesting.functionTests.util.TestNullOutputStream;
 
 
 /**
@@ -598,10 +599,7 @@ public abstract class BaseJDBCTestCase
         throws UnsupportedEncodingException, SQLException
     {
         // Sink output.
-        OutputStream sink = new OutputStream() {
-            public void write(byte[] b, int off, int len) {}
-            public void write(int b) {}
-        };
+        OutputStream sink = new TestNullOutputStream();
         
         // Use the same encoding as the input for the output.    
         return ij.runScript(getConnection(), script, encoding,