ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1738343 - in /webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite: TestWriteTo.java TestWriteToWithReadFromSupport.java WritableBlobTestSuiteBuilder.java
Date Sat, 09 Apr 2016 10:18:16 GMT
Author: veithen
Date: Sat Apr  9 10:18:16 2016
New Revision: 1738343

URL: http://svn.apache.org/viewvc?rev=1738343&view=rev
Log:
Fix test case that doesn't test what it is asserting.

Added:
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteToWithReadFromSupport.java
      - copied, changed from r1734616, webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
Modified:
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/WritableBlobTestSuiteBuilder.java

Modified: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java?rev=1738343&r1=1738342&r2=1738343&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
Sat Apr  9 10:18:16 2016
@@ -20,6 +20,7 @@ package org.apache.axiom.blob.suite;
 
 import static com.google.common.truth.Truth.assertThat;
 
+import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
 import java.util.Random;
 
@@ -28,11 +29,8 @@ import org.apache.axiom.blob.WritableBlo
 import org.apache.axiom.testutils.io.InstrumentedOutputStream;
 
 public class TestWriteTo extends SizeSensitiveWritableBlobTestCase {
-    private final boolean usesReadFromSupport;
-    
-    public TestWriteTo(WritableBlobFactory factory, int size, boolean usesReadFromSupport)
{
+    public TestWriteTo(WritableBlobFactory factory, int size) {
         super(factory, State.NEW, size);
-        this.usesReadFromSupport = usesReadFromSupport;
     }
 
     @Override
@@ -43,13 +41,10 @@ public class TestWriteTo extends SizeSen
         OutputStream out = blob.getOutputStream();
         out.write(data);
         out.close();
-        ByteArrayOutputStreamWithReadFromSupport baos = new ByteArrayOutputStreamWithReadFromSupport();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         InstrumentedOutputStream closeSensor = new InstrumentedOutputStream(baos);
-        blob.writeTo(baos);
+        blob.writeTo(closeSensor);
         assertThat(closeSensor.isClosed()).isFalse();
         assertThat(baos.toByteArray()).isEqualTo(data);
-        if (usesReadFromSupport) {
-            assertThat(baos.isReadFromCalled()).isTrue();
-        }
     }
 }

Copied: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteToWithReadFromSupport.java
(from r1734616, webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteToWithReadFromSupport.java?p2=webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteToWithReadFromSupport.java&p1=webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java&r1=1734616&r2=1738343&rev=1738343&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteTo.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/TestWriteToWithReadFromSupport.java
Sat Apr  9 10:18:16 2016
@@ -25,14 +25,10 @@ import java.util.Random;
 
 import org.apache.axiom.blob.WritableBlob;
 import org.apache.axiom.blob.WritableBlobFactory;
-import org.apache.axiom.testutils.io.InstrumentedOutputStream;
 
-public class TestWriteTo extends SizeSensitiveWritableBlobTestCase {
-    private final boolean usesReadFromSupport;
-    
-    public TestWriteTo(WritableBlobFactory factory, int size, boolean usesReadFromSupport)
{
+public class TestWriteToWithReadFromSupport extends SizeSensitiveWritableBlobTestCase {
+    public TestWriteToWithReadFromSupport(WritableBlobFactory factory, int size) {
         super(factory, State.NEW, size);
-        this.usesReadFromSupport = usesReadFromSupport;
     }
 
     @Override
@@ -44,12 +40,8 @@ public class TestWriteTo extends SizeSen
         out.write(data);
         out.close();
         ByteArrayOutputStreamWithReadFromSupport baos = new ByteArrayOutputStreamWithReadFromSupport();
-        InstrumentedOutputStream closeSensor = new InstrumentedOutputStream(baos);
         blob.writeTo(baos);
-        assertThat(closeSensor.isClosed()).isFalse();
         assertThat(baos.toByteArray()).isEqualTo(data);
-        if (usesReadFromSupport) {
-            assertThat(baos.isReadFromCalled()).isTrue();
-        }
+        assertThat(baos.isReadFromCalled()).isTrue();
     }
 }

Modified: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/WritableBlobTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/WritableBlobTestSuiteBuilder.java?rev=1738343&r1=1738342&r2=1738343&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/WritableBlobTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/blob/suite/WritableBlobTestSuiteBuilder.java
Sat Apr  9 10:18:16 2016
@@ -71,7 +71,10 @@ public class WritableBlobTestSuiteBuilde
         addTest(new TestMarkReset(factory, size));
         addTest(new TestReadFrom(factory, size));
         addTest(new TestRandomReadWrite(factory, size));
-        addTest(new TestWriteTo(factory, size, writeToUsesReadFromSupport));
+        addTest(new TestWriteTo(factory, size));
+        if (writeToUsesReadFromSupport) {
+            addTest(new TestWriteToWithReadFromSupport(factory, size));
+        }
         addTest(new TestWriteToWithError(factory, size));
     }
 }



Mime
View raw message