ZipkinBanner implements Banner { @Override public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) { try (InputStream stream = new ClassPathResource("zipkin.txt").getInputStream()) { String banner = StreamUtils.copyToString(stream, UTF_8); banner = banner.replace("${AnsiOrange}", AnsiOutput.encode(ZIPKIN_ORANGE)); banner = banner.replace("${AnsiNormal}", AnsiOutput.encode(AnsiStyle.NORMAL)); out.println(banner); } catch (Exception ex) { } }  @Override void printBanner(Environment environment, Class<?> sourceClass, PrintStream out);  }
@Test public void shouldReplaceWhenAnsiEnabled() { AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS); ZipkinBanner banner = new ZipkinBanner(); ByteArrayOutputStream out = new ByteArrayOutputStream(); banner.printBanner(null, null, new PrintStream(out)); assertThat(new String(out.toByteArray(), UTF_8)) .doesNotContain("${") .contains("\033"); }
@Test public void shouldReplaceWhenAnsiDisabled() { AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); ZipkinBanner banner = new ZipkinBanner(); ByteArrayOutputStream out = new ByteArrayOutputStream(); banner.printBanner(null, null, new PrintStream(out)); assertThat(new String(out.toByteArray(), UTF_8)) .doesNotContain("${") .doesNotContain("\033"); }