### Question:
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; output.bleScanDurationMs = bleScanDurationMs + b.bleScanDurationMs; output.bleOpportunisticScanCount = bleOpportunisticScanCount + b.bleOpportunisticScanCount; output.bleOpportunisticScanDurationMs = bleOpportunisticScanDurationMs + b.bleOpportunisticScanDurationMs; } return output; }  @Override BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output); @Override BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output); @Override BluetoothMetrics set(BluetoothMetrics b); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); public int bleScanCount; public long bleScanDurationMs; public int bleOpportunisticScanCount; public long bleOpportunisticScanDurationMs; }### Answer:
@Test public void testSum() { BluetoothMetrics metricsA = new BluetoothMetrics(); metricsA.bleScanDurationMs = 1000; metricsA.bleScanCount = 10; metricsA.bleOpportunisticScanDurationMs = 4000; metricsA.bleOpportunisticScanCount = 1; BluetoothMetrics metricsB = new BluetoothMetrics(); metricsB.bleScanDurationMs = 2000; metricsB.bleScanCount = 20; metricsB.bleOpportunisticScanDurationMs = 8000; metricsB.bleOpportunisticScanCount = 2; BluetoothMetrics output = new BluetoothMetrics(); metricsA.sum(metricsB, output); assertThat(output.bleScanCount).isEqualTo(30); assertThat(output.bleScanDurationMs).isEqualTo(3000); assertThat(output.bleOpportunisticScanCount).isEqualTo(3); assertThat(output.bleOpportunisticScanDurationMs).isEqualTo(12000); }