### Question:
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = 0; i < b.timer.size(); i++) { timer.append(b.timer.keyAt(i), new TimerMetrics(b.timer.valueAt(i))); } measurements.clear(); for (int i = 0; i < b.measurements.size(); i++) { ArrayMap<String, Long> value = new ArrayMap<>(); value.putAll((Map<String, Long>) b.measurements.valueAt(i)); measurements.append(b.measurements.keyAt(i), value); } timers.clear(); for (int i = 0; i < b.timers.size(); i++) { ArrayMap<String, TimerMetrics> bValue = b.timers.valueAt(i); ArrayMap<String, TimerMetrics> value = new ArrayMap<>(); for (int j = 0; j < bValue.size(); j++) { value.put(bValue.keyAt(j), new TimerMetrics(bValue.valueAt(j))); } timers.append(b.timers.keyAt(i), value); } stats.clear(); for (int i = 0; i < b.stats.size(); i++) { ArrayMap<String, HealthStatsMetrics> bValue = b.stats.valueAt(i); ArrayMap<String, HealthStatsMetrics> value = new ArrayMap<>(); for (int j = 0; j < bValue.size(); j++) { value.put(bValue.keyAt(j), new HealthStatsMetrics(bValue.valueAt(j))); } stats.append(b.stats.keyAt(i), value); } return this; } HealthStatsMetrics();  HealthStatsMetrics(HealthStats healthStats);  HealthStatsMetrics(HealthStatsMetrics metrics); @Override HealthStatsMetrics sum(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics diff(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics set(HealthStatsMetrics b); HealthStatsMetrics set(HealthStats healthStats); @Override String toString(); static String getKeyName(int key); JSONObject toJSONObject(); @Override boolean equals(Object o); @Override int hashCode(); public String dataType; final SparseArray<Long> measurement; final SparseArray<TimerMetrics> timer; final SparseArray<ArrayMap<String, Long>> measurements; final SparseArray<ArrayMap<String, TimerMetrics>> timers; final SparseArray<ArrayMap<String, HealthStatsMetrics>> stats; }### Answer:
@Test public void testSetUninitialized() { HealthStatsMetrics initialized = createTestMetrics(); HealthStatsMetrics uninitialized = new HealthStatsMetrics(); uninitialized.set(initialized); assertThat(uninitialized).isEqualTo(initialized); }
@Test public void testSetInitialized() throws Exception { HealthStatsMetrics initialized = createTestMetrics(); HealthStatsMetrics uninitialized = new HealthStatsMetrics(); initialized.set(uninitialized); assertThat(uninitialized).isEqualTo(initialized); }