### Question:
WakeLockMetrics extends SystemMetrics<WakeLockMetrics> { @Override public WakeLockMetrics set(WakeLockMetrics b) { heldTimeMs = b.heldTimeMs; acquiredCount = b.acquiredCount; if (b.isAttributionEnabled && isAttributionEnabled) { tagTimeMs.clear(); tagTimeMs.putAll(b.tagTimeMs); } return this; } WakeLockMetrics();  WakeLockMetrics(boolean isAttributionEnabled); @Override WakeLockMetrics sum(@Nullable WakeLockMetrics b, @Nullable WakeLockMetrics output); @Override WakeLockMetrics diff(@Nullable WakeLockMetrics b, @Nullable WakeLockMetrics output); @Override WakeLockMetrics set(WakeLockMetrics b); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nullable JSONObject attributionToJSONObject(); public boolean isAttributionEnabled; final SimpleArrayMap<String, Long> tagTimeMs; public long heldTimeMs; public long acquiredCount; }### Answer:
@Test public void testSetWithoutAttribution() { WakeLockMetrics metrics = new WakeLockMetrics(); metrics.heldTimeMs = 10l; metrics.acquiredCount = 31; WakeLockMetrics alternate = new WakeLockMetrics(); alternate.set(metrics); assertThat(alternate).isEqualTo(metrics); }
@Test public void testSetWithAttribution() { WakeLockMetrics metrics = new WakeLockMetrics(true); metrics.heldTimeMs = 10l; metrics.acquiredCount = 23; metrics.tagTimeMs.put("TestWakeLock", 10l); WakeLockMetrics alternate = new WakeLockMetrics(true); alternate.set(metrics); assertThat(alternate).isEqualTo(metrics); }