21 lines
465 B
Java
21 lines
465 B
Java
|
package testutil;
|
||
|
|
||
|
import java.io.*;
|
||
|
|
||
|
public class TestUtilities {
|
||
|
|
||
|
public static InputStream createInputStreamFromString(String string) {
|
||
|
return new ByteArrayInputStream(string.getBytes());
|
||
|
}
|
||
|
|
||
|
public static InputStream createIOExceptionThrowingInputStream() {
|
||
|
return new InputStream() {
|
||
|
|
||
|
public int read() throws IOException {
|
||
|
throw new IOException("test IOException");
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
}
|