Class MockOutputStream

  • All Implemented Interfaces:
    Verifiable, java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class MockOutputStream
    extends java.io.OutputStream
    implements Verifiable
    • Constructor Detail

      • MockOutputStream

        public MockOutputStream()
    • Method Detail

      • clearActualBuffer

        public void clearActualBuffer()
      • close

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

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.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: Verifiable
        Throw an AssertionFailedException if any expectations have not been met.
        Specified by:
        verify in interface Verifiable
      • write

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