Package com.mockobjects.io
Class MockOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.mockobjects.io.MockOutputStream
-
- All Implemented Interfaces:
Verifiable,java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class MockOutputStream extends java.io.OutputStream implements Verifiable
-
-
Constructor Summary
Constructors Constructor Description MockOutputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearActualBuffer()voidclose()voidflush()java.lang.StringgetContents()byte[]getContentsAsByteArray()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)
-
-
-
Method Detail
-
clearActualBuffer
public void clearActualBuffer()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
getContents
public java.lang.String 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
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
-