RoboZonkyStartupNotifier implements ShutdownHook.Handler { String readBanner(String version) { var banner = "robozonky-banner.txt"; try (var reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(banner)))) { return reader.lines() .map(String::trim) .map(s -> replaceVersionPlaceholder(s, version)) .collect(Collectors.joining(lineSeparator(), lineSeparator(), "")); } catch (Exception ex) { LOGGER.debug("Failed reading banner resource.", ex); return "===== RoboZonky v" + version + " '" + session.getName() + "' at your service! ====="; } } RoboZonkyStartupNotifier(final SessionInfo session); @Override Optional<Consumer<ReturnCode>> get();  }
@Test void properBanner() { String lineSep = lineSeparator(); String expected = lineSep + "################################################################################" + lineSep + "# ____ __ _____ __ #" + lineSep + "# / __ \\ ____ / /_ ____ /__ / ____ ____ / /__ __ __ #" + lineSep + "# / /_/ / / __ \\ / __ \\ / __ \\ / / / __ \\ / __ \\ / "# / _, _/ / /_/ / / /_/ "# /_/ |_| \\____/ /_.___/ \\____/ /____/\\____/ /_/ /_/ /_/|_| \\__, / #" + lineSep + "# v6.0.0-SNAPSHOT 'Testing' /____/ #" + lineSep + "# #" + lineSep + "################################################################################"; final RoboZonkyStartupNotifier rzsn = new RoboZonkyStartupNotifier(SESSION); assertThat(rzsn.readBanner("6.0.0-SNAPSHOT")).isEqualTo(expected); }