@Test
public void testFailsGracefullyOnIOException() throws Exception {

	InputStream is = new InputStream() {
		@Override
		public int read() throws IOException {
			throw new IOException("exception for test");
		}
	};
	InputStreamWriter writer = new InputStreamWriter(is);
	File file = new File(getContext().getCacheDir(), "test_file");
	boolean result = writer.write(file);
	Assert.assertFalse(result);
}