Search in sources :

Example 1 with ExceptionOutputStream

use of org.apache.axiom.testutils.io.ExceptionOutputStream in project webservices-axiom by apache.

the class TestWriteToWithError method runTest.

@Override
protected void runTest(WritableBlob blob) throws Throwable {
    blob.readFrom(new NullInputStream(size));
    ExceptionOutputStream out = new ExceptionOutputStream(size / 2);
    try {
        blob.writeTo(out);
        fail("Expected StreamCopyException");
    } catch (StreamCopyException ex) {
        assertThat(ex.getOperation()).isEqualTo(StreamCopyException.WRITE);
        assertThat(ex.getCause()).isSameAs(out.getException());
    }
}
Also used : StreamCopyException(org.apache.axiom.ext.io.StreamCopyException) ExceptionOutputStream(org.apache.axiom.testutils.io.ExceptionOutputStream) NullInputStream(org.apache.commons.io.input.NullInputStream)

Aggregations

StreamCopyException (org.apache.axiom.ext.io.StreamCopyException)1 ExceptionOutputStream (org.apache.axiom.testutils.io.ExceptionOutputStream)1 NullInputStream (org.apache.commons.io.input.NullInputStream)1