private static MetricsSnapshot metricsSnapshot(boolean includeSamzaEpochId) {
    MetricsHeader metricsHeader;
    if (includeSamzaEpochId) {
      metricsHeader = new MetricsHeader("test-jobName", "testjobid", "samza-container-0", "test exec env container id",
          Optional.of("epoch-123"), "test source", "version", "samzaversion", "host", 1L, 2L);
    } else {
      metricsHeader = new MetricsHeader("test-jobName", "testjobid", "samza-container-0", "test exec env container id",
          "test source", "version", "samzaversion", "host", 1L, 2L);
    }
    Map<String, Object> metricsMap = new HashMap<>();
    metricsMap.put("test2", "foo");
    Map<String, Map<String, Object>> metricsGroupMap = new HashMap<>();
    metricsGroupMap.put("test", metricsMap);
    return new MetricsSnapshot(metricsHeader, Metrics.fromMap(metricsGroupMap));
  }
Helps for verifying compatibility when schemas evolve.
samza-core/src/test/java/org/apache/samza/serializers/TestMetricsSnapshotSerde.java