java.lang.Object
java.io.OutputStream
com.mockobjects.io.MockOutputStream
- All Implemented Interfaces:
- com.mockobjects.Verifiable
- public class MockOutputStream
- extends java.io.OutputStream
- implements com.mockobjects.Verifiable
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
myWriteWasCalled
private com.mockobjects.ExpectationValue myWriteWasCalled
myCloseCalls
private com.mockobjects.ExpectationCounter myCloseCalls
myFlushCalls
private com.mockobjects.ExpectationCounter myFlushCalls
myBuffer
private java.io.ByteArrayOutputStream myBuffer
shouldThrowException
private boolean shouldThrowException
MockOutputStream
public MockOutputStream()
clearActualBuffer
public void clearActualBuffer()
close
public void close()
throws java.io.IOException
- Description copied from class:
java.io.OutputStream
- This method closes the stream. Any internal or native resources
associated with this stream are freed. Any subsequent attempt to
access the stream might throw an exception.
This method in this class does nothing.
flush
public void flush()
throws java.io.IOException
- Description copied from class:
java.io.OutputStream
- This method forces any data that may have been buffered to be written
to the underlying output device. Please note that the host environment
might perform its own buffering unbeknowst to Java. In that case, a
write made (for example, to a disk drive) might be cached in OS
buffers instead of actually being written to disk.
This method in this class does nothing.
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:
com.mockobjects.Verifiable
- Throw an AssertionFailedException if any expectations have not been met.
- Specified by:
verify in interface com.mockobjects.Verifiable
write
public void write(int b)
throws java.io.IOException
- Description copied from class:
java.io.OutputStream
- This method writes a single byte to the output stream. The byte written
is the low eight bits of the
int passed and a argument.
Subclasses must provide an implementation of this abstract method