-
-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c81a26
commit d005e6c
Showing
3 changed files
with
77 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/com/fasterxml/jackson/core/testsupport/ByteOutputStreamForTesting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.fasterxml.jackson.core.testsupport; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
|
||
/** | ||
* Helper class for verifying that {@link java.io.OutputStream} is (or is not) | ||
* closed and/or flushed. | ||
*/ | ||
public class ByteOutputStreamForTesting extends ByteArrayOutputStream | ||
{ | ||
public int closeCount = 0; | ||
public int flushCount = 0; | ||
|
||
public ByteOutputStreamForTesting() { } | ||
|
||
@Override | ||
public void close() throws IOException { | ||
++closeCount; | ||
super.close(); | ||
} | ||
|
||
@Override | ||
public void flush() throws IOException | ||
{ | ||
++flushCount; | ||
super.flush(); | ||
} | ||
|
||
public boolean isClosed() { return closeCount > 0; } | ||
public boolean isFlushed() { return flushCount > 0; } | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/com/fasterxml/jackson/core/testsupport/StringWriterForTesting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.fasterxml.jackson.core.testsupport; | ||
|
||
import java.io.IOException; | ||
import java.io.StringWriter; | ||
|
||
public class StringWriterForTesting extends StringWriter | ||
{ | ||
public int closeCount = 0; | ||
public int flushCount = 0; | ||
|
||
public StringWriterForTesting() { } | ||
|
||
@Override | ||
public void close() throws IOException { | ||
++closeCount; | ||
super.close(); | ||
} | ||
|
||
@Override | ||
public void flush() | ||
{ | ||
++flushCount; | ||
super.flush(); | ||
} | ||
|
||
public boolean isClosed() { return closeCount > 0; } | ||
public boolean isFlushed() { return flushCount > 0; } | ||
} |