BrokerCfg { public String toJson() { try { return getDefaultJsonObjectWriter().writeValueAsString(this); } catch (final JsonProcessingException e) { throw new UncheckedExecutionException("Writing to JSON failed", e); } }  void init(final String brokerBase); void init(final String brokerBase, final Environment environment); NetworkCfg getNetwork(); void setNetwork(final NetworkCfg network); ClusterCfg getCluster(); void setCluster(final ClusterCfg cluster); ThreadsCfg getThreads(); void setThreads(final ThreadsCfg threads); DataCfg getData(); void setData(final DataCfg logs); Map<String, ExporterCfg> getExporters(); void setExporters(final Map<String, ExporterCfg> exporters); EmbeddedGatewayCfg getGateway(); BrokerCfg setGateway(final EmbeddedGatewayCfg gateway); BackpressureCfg getBackpressure(); BrokerCfg setBackpressure(final BackpressureCfg backpressure); Duration getStepTimeout(); void setStepTimeout(final Duration stepTimeout); boolean isExecutionMetricsExporterEnabled(); void setExecutionMetricsExporterEnabled(final boolean executionMetricsExporterEnabled); @Override String toString(); String toJson();  }
@Test public void shouldNotPrintConfidentialInformation() throws Exception { final var brokerCfg = TestConfigReader.readConfig("elasticexporter", environment); final var json = brokerCfg.toJson(); final var objectMapper = new ObjectMapper(); final var jsonNode = objectMapper.readTree(json); final var arguments = jsonNode.get("exporters").get("elasticsearch").get("args").get("authentication"); assertThat(arguments.get("password").asText()).isEqualTo("***"); assertThat(arguments.get("username").asText()).isEqualTo("***"); }