Interface OutputStreamDelegateTests
-
- All Known Subinterfaces:
OutputStreamDelegateTests.CloseTests
,OutputStreamDelegateTests.FlushTests
,OutputStreamDelegateTests.WriteByteArrayPortionTests
,OutputStreamDelegateTests.WriteByteArrayTests
,OutputStreamDelegateTests.WriteByteTests
public interface OutputStreamDelegateTests
Base interface for testing thatOutputStream
implementations correctly delegate to anotherOutputStream
.- Author:
- Rob Spoor
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
OutputStreamDelegateTests.CloseTests
Contains tests forOutputStream.close()
.static interface
OutputStreamDelegateTests.FlushTests
Contains tests forOutputStream.flush()
.static interface
OutputStreamDelegateTests.WriteByteArrayPortionTests
Contains tests forOutputStream.write(byte[], int, int)
.static interface
OutputStreamDelegateTests.WriteByteArrayTests
Contains tests forOutputStream.write(byte[])
.static interface
OutputStreamDelegateTests.WriteByteTests
Contains tests forOutputStream.write(int)
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default byte[]
contentToWrite()
Returns the content to write for most tests.byte[]
expectedContent(byte[] written)
Returns the expected content written to a delegate, based on the content that was written to acreated output stream
.default byte[]
longContentToWrite()
Returns the content to write when testing writing large chunks.OutputStream
wrapOutputStream(OutputStream delegate)
Creates the output stream to test.
-
-
-
Method Detail
-
wrapOutputStream
OutputStream wrapOutputStream(OutputStream delegate)
Creates the output stream to test.This method will be called only once for each test. This makes it possible to capture the output stream to test and its delegate, and perform additional tests after the pre-defined test has finished.
- Parameters:
delegate
- The delegate to test against.- Returns:
- The created output stream.
-
expectedContent
byte[] expectedContent(byte[] written)
Returns the expected content written to a delegate, based on the content that was written to acreated output stream
.- Parameters:
written
- The content that was written.- Returns:
- The expected content.
-
contentToWrite
default byte[] contentToWrite()
Returns the content to write for most tests. This default implementation returns a lorem ipsum text.- Returns:
- The content to write.
-
longContentToWrite
default byte[] longContentToWrite()
Returns the content to write when testing writing large chunks. this default implementation returnscontentToWrite()
concatenated1000
times.- Returns:
- The content to write when testing writing large pieces of text.
-
-