### Question:
YamlKeysWriter implements KeysWriter { @Override public void writeKeys(final BLSKeyPair validatorKey, final BLSKeyPair withdrawalKey) throws UncheckedIOException { final String yamlLine = getYamlFormattedString(validatorKey, withdrawalKey); if (outputPath == null) { standardOut.print(yamlLine); } else { try { Files.writeString( outputPath, yamlLine, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.APPEND); } catch (IOException e) { STATUS_LOG.validatorDepositYamlKeyWriterFailure(outputPath); throw new UncheckedIOException(e); } } } YamlKeysWriter(final Path outputPath); @VisibleForTesting  YamlKeysWriter(final PrintStream standardOut); @Override void writeKeys(final BLSKeyPair validatorKey, final BLSKeyPair withdrawalKey);  }### Answer:
@Test void keysAreWrittenOnSystemOutput() { final ByteArrayOutputStream bytesStream = new ByteArrayOutputStream(); final KeysWriter keysWriter = new YamlKeysWriter(new PrintStream(bytesStream, true, UTF_8)); keysWriter.writeKeys(new BLSKeyPair(validator1SecretKey), new BLSKeyPair(withdrawal1SecretKey)); assertThat(new String(bytesStream.toByteArray(), UTF_8)).isEqualTo(yamlLine1); keysWriter.writeKeys(new BLSKeyPair(validator2SecretKey), new BLSKeyPair(withdrawal2SecretKey)); assertThat(new String(bytesStream.toByteArray(), UTF_8)).isEqualTo(expectedYaml); }