@Test
public void testFlush() {

	AtomicBoolean calledFlush = new AtomicBoolean();
	UnsyncPrintWriter unsyncPrintWriter = new UnsyncPrintWriter(
		new StringWriter() {
			@Override
			public void flush() {
				calledFlush.set(true);
			}
		});
	unsyncPrintWriter.flush();
	Assert.assertTrue(calledFlush.get());
	calledFlush.set(false);
	unsyncPrintWriter.close();
	unsyncPrintWriter.flush();
	Assert.assertFalse(calledFlush.get());
	Assert.assertTrue(unsyncPrintWriter.checkError());
	unsyncPrintWriter.reset(null);
	Assert.assertFalse(unsyncPrintWriter.checkError());
	unsyncPrintWriter.reset(
		new Writer() {
			@Override
			public void close() {
				throw new UnsupportedOperationException();
			}
			@Override
			public void flush() throws IOException {
				throw new IOException();
			}
			@Override
			public void write(char[] cbuf, int off, int len) {
				throw new UnsupportedOperationException();
			}
		});
	unsyncPrintWriter.flush();
	Assert.assertTrue(unsyncPrintWriter.checkError());
}