[ https://issues.apache.org/jira/browse/IO-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jukka Zitting updated IO-193:
-----------------------------
Fix Version/s: (was: 1.5)
2.0
> Broken input and output streams
> -------------------------------
>
> Key: IO-193
> URL: https://issues.apache.org/jira/browse/IO-193
> Project: Commons IO
> Issue Type: New Feature
> Components: Streams/Writers
> Reporter: Jukka Zitting
> Assignee: Jukka Zitting
> Priority: Minor
> Fix For: 2.0
>
> Attachments: IO-193.patch
>
>
> When testing error handling in code that uses streams one needs a way to simulate an
IOException being thrown by a stream. Typically this means using a custom stream class that
throws the desired exception. To avoid having to implement such custom classes over and over
again for multiple projects, I'd like to introduce such classes in Commons IO.
> The proposed BrokenInputStream and BrokenOutputStream always throw a given IOException
from all InputStream and OutputStream methods that declare such exceptions.
> For example, the following fictional test code:
> {code}
> Result result = processStream(new InputStream() {
> public int read() throws IOException {
> throw new IOException("test");
> }
> });
> assertEquals(PROCESSING_FAILED, result);
> {code}
> could be replaced with:
> {code}
> Result result = processStream(new BrokenInputStream());
> assertEquals(PROCESSING_FAILED, result);
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|