private Throwable createIoException() { Throwable exception = null; try { new FileInputStream(new File(NON_EXISTING_FILE)); fail("Managed to find a file that shouldn't exist " + NON_EXISTING_FILE); } catch (IOException ioe) { if (ioe.getStackTrace() == null || ioe.getStackTrace().length == 0) { ioe.fillInStackTrace(); } exception = ioe; } return exception; }