From: Francois B. <fbe...@ft...> - 2003-03-10 17:04:38
|
Log message: * MockOutputStream.java: Added expectations for flush() calls on MockOutputStream. Patch: Index: src/jdk/common/com/mockobjects/io/MockOutputStream.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/io/MockOutputStream.java,v retrieving revision 1.3 diff -u -r1.3 MockOutputStream.java --- src/jdk/common/com/mockobjects/io/MockOutputStream.java 8 Jul 2002 18:31:29 -0000 1.3 +++ src/jdk/common/com/mockobjects/io/MockOutputStream.java 10 Mar 2003 17:00:14 -0000 @@ -12,6 +12,7 @@ public class MockOutputStream extends OutputStream implements Verifiable { private ExpectationValue myWriteWasCalled = new ExpectationValue("MockOutputStream.writeWasCalled"); private ExpectationCounter myCloseCalls = new ExpectationCounter("MockOutputStream.close()"); + private ExpectationCounter myFlushCalls = new ExpectationCounter("MockOutputStream.flush()"); private ByteArrayOutputStream myBuffer = new ByteArrayOutputStream(); private boolean shouldThrowException = false; @@ -27,6 +28,10 @@ myCloseCalls.inc(); } + public void flush() throws IOException { + myFlushCalls.inc(); + } + public String getContents() { return myBuffer.toString(); } @@ -42,6 +47,10 @@ myCloseCalls.setExpected(closeCall); } + public void setExpectedFlushCalls(int flushCall) { + myFlushCalls.setExpected(flushCall); + } + public void setExpectingWriteCalls(boolean expectingWriteCall) { myWriteWasCalled.setExpected(expectingWriteCall); } @@ -56,7 +65,7 @@ public void write(int b) throws IOException { myWriteWasCalled.setActual(true); - if(shouldThrowException) { + if (shouldThrowException) { throw new IOException("Test IOException generated by request"); } myBuffer.write(b); -- http://www.fastmail.fm - Choose from over 50 domains or use your own |