assertSame(thrown, caught);
}
}
public void testFlush() {
Exception flushed = Utils.flush(new Flushable() {
public void flush() throws IOException {
}
});
assertNull(flushed);
final IOException ioe = new IOException();
flushed = Utils.flush(new Flushable() {
public void flush() throws IOException {
throw ioe;
}
});
assertSame(ioe, flushed);
final RuntimeException re = new RuntimeException();
flushed = Utils.flush(new Flushable() {
public void flush() throws IOException {
throw re;
}
});
assertSame(re, flushed);
final Error thrown = new Error();
try {
Utils.flush(new Flushable() {
public void flush() throws IOException {
throw thrown;
}
});
}