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 TypeMethodDescriptionvoidvoidclose()voidflush()byte[]Added in response to Bug report 546661.voidsetExpectedCloseCalls(int closeCall) voidsetExpectedFlushCalls(int flushCall) voidsetExpectingWriteCalls(boolean expectingWriteCall) voidsetupThrowIOException(boolean throwException) voidverify()Throw an AssertionFailedException if any expectations have not been met.voidwrite(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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin 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:VerifiableThrow an AssertionFailedException if any expectations have not been met.- Specified by:
verifyin interfaceVerifiable
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-