Class MockOutputStream

java.lang.Object
java.io.OutputStream
com.mockobjects.io.MockOutputStream
All Implemented Interfaces:
Verifiable, Closeable, Flushable, AutoCloseable

public class MockOutputStream extends OutputStream implements Verifiable
  • Constructor Details

    • MockOutputStream

      public MockOutputStream()
  • Method Details

    • clearActualBuffer

      public void clearActualBuffer()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
      Throws:
      IOException
    • getContents

      public 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: Verifiable
      Throw an AssertionFailedException if any expectations have not been met.
      Specified by:
      verify in interface Verifiable
    • write

      public void write(int b) throws IOException
      Specified by:
      write in class OutputStream
      Throws:
      IOException