### Question:
ExceptionHandler extends EventQueue implements Thread.UncaughtExceptionHandler { public static String readAndTruncateInputStream(InputStream inputStream, int maxLength) { try { String contents = CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8)); if (Strings.isNullOrEmpty(contents)) { return "Contents are empty"; } String userName = System.getProperty("user.name"); contents = contents .replace("/" + userName + "/", "") .replace("\\" + userName + "\\", "\\*blank*\\"); int offset = Math.max(0, contents.length() - maxLength); if (offset > 0) { int firstLineBreak = contents.substring(offset).indexOf('\n') + 1; return contents.substring(offset + firstLineBreak); } else { return contents.substring(offset); } } catch (IOException e) { return "Contents could not be read: " + e.getMessage(); } }  static void registerExceptionHandler(); @SuppressWarnings("unchecked") static void handleThrowable(Throwable t); @SuppressWarnings("unchecked") static void handleManualErrorReport(); @Override void uncaughtException(Thread t, Throwable e); static SubscriberExceptionHandler newSubscriberExceptionHandler(); static String readAndTruncateInputStream(InputStream inputStream, int maxLength); static ErrorReportResult handleErrorReportUpload(String userNotes, URL errorReportingUrl); static final String LIVE_ERROR_REPORTING_URL; }### Answer:
@Test public void testReadTruncatedCurrentLogfile() throws Exception { InputStream is = ExceptionHandlerTest.class.getResourceAsStream("/fixtures/error_reporting/test-multibit-hd.log"); String result = ExceptionHandler.readAndTruncateInputStream(is, 4096); assertThat(result).startsWith("{"); }