@Test
public void testFailWrite() throws Exception {

    doCallRealMethod().when(reader).finishWrite(any(FileOutputStream.class));
    doCallRealMethod().when(reader).failWrite(any(FileOutputStream.class));
    when(workFile.delete()).thenReturn(true);
    try {
        reader.failWrite(fos);
    } catch (Exception e) {
        fail("Should not throw");
    }
    when(workFile.delete()).thenReturn(false);
    try {
        reader.failWrite(fos);
        fail("Should throw");
    } catch (Exception e) {
        // pass
    }
}