### Question:
TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes); void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes); static final String EVENTS_TOTAL; static final String EVENTS_FAILED; }### Answer:
@Test public void addRxBytesForMobileType() { telemetryMetrics.addRxBytesForType(ConnectivityManager.TYPE_MOBILE, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.MOBILE_BYTES_RX); assertThat(metrics.getValue()).isEqualTo(10L); }
@Test public void addRxBytesForWifiType() { telemetryMetrics.addRxBytesForType(ConnectivityManager.TYPE_WIFI, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.WIFI_BYTES_RX); assertThat(metrics.getValue()).isEqualTo(10L); }