Util { public static String stackTraceToString(final Throwable t) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); t.printStackTrace(pw); return sw.toString(); } private  Util(); static Date toDate(final LocalDate localDate); static Date toDate(final OffsetDateTime offsetDateTime); static Date toDate(final ZonedDateTime zonedDateTime); static String identifyLoan(final LoanBased event); static Map<String, Object> getLoanData(final Loan loan); static Map<String, Object> getDelinquencyData(final Investment investment); static Map<String, Object> getLoanData(final Investment i, final Loan l); static Map<String, Object> summarizePortfolioStructure(final PortfolioOverview portfolioOverview); static Map<String, Object> summarizePortfolioStructure(final ExtendedPortfolioOverview portfolioOverview); static boolean isNetworkProblem(final Throwable ex); static Map<String, Object> getDelinquentData(final Investment i, final Loan loan, final LocalDate date); static String stackTraceToString(final Throwable t); static String obfuscateEmailAddress(final String username);  }
@Test void stackTrace() { final String result = Util.stackTraceToString(new IllegalStateException()); assertThat(result).contains("IllegalStateException"); }