@Test
public void testFailsGracefullyOnFileNotFound() throws Exception {

	InputStream is = new InputStream() {
		private int calls = 10;
		@Override
		public int read() throws IOException {
			if (calls < 20) return calls++;
			else return -1;
		}
	};
	InputStreamWriter writer = new InputStreamWriter(is);
	File file = new File("http://invalid_file_name");
	boolean result = writer.write(file);
	Assert.assertFalse(result);
}