Package com.mockobjects.io
Class MockOutputStream
java.lang.Object
java.io.OutputStream
com.mockobjects.io.MockOutputStream
- All Implemented Interfaces:
Verifiable
,Closeable
,Flushable
,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
close()
void
flush()
byte[]
Added in response to Bug report 546661.void
setExpectedCloseCalls
(int closeCall) void
setExpectedFlushCalls
(int flushCall) void
setExpectingWriteCalls
(boolean expectingWriteCall) void
setupThrowIOException
(boolean throwException) void
verify()
Throw an AssertionFailedException if any expectations have not been met.void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
Constructor Details
-
MockOutputStream
public MockOutputStream()
-
-
Method Details
-
clearActualBuffer
public void clearActualBuffer() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
getContents
-
getContentsAsByteArray
public byte[] getContentsAsByteArray()Added in response to Bug report 546661. -
setExpectedCloseCalls
public void setExpectedCloseCalls(int closeCall) -
setExpectedFlushCalls
public void setExpectedFlushCalls(int flushCall) -
setExpectingWriteCalls
public void setExpectingWriteCalls(boolean expectingWriteCall) -
setupThrowIOException
public void setupThrowIOException(boolean throwException) -
verify
public void verify()Description copied from interface:Verifiable
Throw an AssertionFailedException if any expectations have not been met.- Specified by:
verify
in interfaceVerifiable
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-