Interface OutputStreamDelegateTests
-
- All Known Subinterfaces:
OutputStreamDelegateTests.CloseTests,OutputStreamDelegateTests.FlushTests,OutputStreamDelegateTests.WriteByteArrayPortionTests,OutputStreamDelegateTests.WriteByteArrayTests,OutputStreamDelegateTests.WriteByteTests
public interface OutputStreamDelegateTestsBase interface for testing thatOutputStreamimplementations correctly delegate to anotherOutputStream.- Author:
- Rob Spoor
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceOutputStreamDelegateTests.CloseTestsContains tests forOutputStream.close().static interfaceOutputStreamDelegateTests.FlushTestsContains tests forOutputStream.flush().static interfaceOutputStreamDelegateTests.WriteByteArrayPortionTestsContains tests forOutputStream.write(byte[], int, int).static interfaceOutputStreamDelegateTests.WriteByteArrayTestsContains tests forOutputStream.write(byte[]).static interfaceOutputStreamDelegateTests.WriteByteTestsContains 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. this default implementation returnscontentToWrite()concatenated1000times.OutputStreamwrapOutputStream(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()concatenated1000times.- Returns:
- The content to write when testing writing large pieces of text.
-
-