OutputPrinter implements OutputStateLogger { @Override public void error(final String message, Arg... args) { String errorMessage = MessageFormatter.arrayFormat(message, args).getMessage(); logger.error(message, args); System.err.println(errorMessage); } OutputPrinter(Logger logger); @Override void info(String message, Arg... args); @Override void warn(String message, Arg... args); @Override void error(final String message, Arg... args);  }
@Test public void testErrorPrintingWorksWithMultipleReplacement() { String systemErr = StandardStreamUtilities.wrapSystemErr( () -> print.error("Replace {} of {} {}.", SafeArg.of("all", "all"), SafeArg.of("these", "these"), SafeArg.of("fields", "fields"))); assertThat(systemErr).contains("Replace all of these fields. "); }