BasicCollector extends Collector { @Override public GenericContainer collectMetrics() { SupportKafkaMetricsBasic metricsRecord = new SupportKafkaMetricsBasic(); metricsRecord.setTimestamp(time.nowInUnixTime()); metricsRecord.setKafkaVersion(AppInfoParser.getVersion()); metricsRecord.setConfluentPlatformVersion(Version.getVersion()); metricsRecord.setCollectorState(this.getRuntimeState().stateId()); metricsRecord.setBrokerProcessUUID(uuid.toString()); metricsRecord.setClusterId(server.clusterId()); return metricsRecord; } BasicCollector(
      KafkaServer server,
      TimeUtils time
  );  BasicCollector(
      KafkaServer server,
      TimeUtils time,
      Uuid uuid
  ); @Override GenericContainer collectMetrics();  }
@Test public void testCollectMetrics() { TimeUtils time = new TimeUtils(); Uuid uuid = new Uuid(); long unixTimeAtTestStart = time.nowInUnixTime(); Collector metricsCollector = new BasicCollector(mockServer, time, uuid); GenericContainer metricsRecord = metricsCollector.collectMetrics(); assertThat(metricsRecord).isInstanceOf(SupportKafkaMetricsBasic.class); assertThat(metricsRecord.getSchema()).isEqualTo(SupportKafkaMetricsBasic.getClassSchema()); SupportKafkaMetricsBasic basicRecord = (SupportKafkaMetricsBasic) metricsRecord; assertThat(basicRecord.getTimestamp()).isBetween(unixTimeAtTestStart, time.nowInUnixTime()); assertThat(basicRecord.getKafkaVersion()).isEqualTo(AppInfoParser.getVersion()); assertThat(basicRecord.getConfluentPlatformVersion()).isEqualTo(Version.getVersion()); assertThat(basicRecord.getCollectorState()).isEqualTo(metricsCollector.getRuntimeState().stateId()); assertThat(basicRecord.getBrokerProcessUUID()).isEqualTo(uuid.toString()); }