public void start() {
    if (running.get()) {
      throw new IllegalStateException(
          "Attempting to start a MetricsSystem that is already running");
    }
    running.set(true);
    registerDefaultSources();
    registerSinks();
    sinks.forEach(Sink::start);
  }
@Test
  void testMetricsSystemWithTwoSinkConfigurations() {
    Properties properties = new Properties();
    properties.put("sink.mocksink.class", "org.apache.spark.k8s.operator.metrics.sink.MockSink");
    properties.put("sink.mocksink.period", "10");
    properties.put("sink.console.class", "org.apache.spark.metrics.sink.ConsoleSink");
    MetricsSystem metricsSystem = new MetricsSystem(properties);
    metricsSystem.start();
    assertEquals(3, metricsSystem.getSinks().size());
  }