@Test public void doesNotReportBytesDownloadedIfItIsTheFirstTimeTheInfoIsCollected() { givenTheDownloadedBytesAre(ANY_AMOUNT_OF_BYTES); collector.initialize(registry); Gauge<Long> gauge = bytesDownloadedCaptor.getValue(); assertNull(gauge.getValue()); }
@Override public void initialize(MetricRegistry registry) { if (!isTrafficStatsAPISupported()) { return; } registerCachedGaugesForUploadedBytes(registry, false); registerCachedGaugeForDownloadedBytes(registry, false); registerCachedGaugesForUploadedBytes(registry, true); registerCachedGaugeForDownloadedBytes(registry, true); }
NetworkUsageCollector implements Collector { @Override public void initialize(MetricRegistry registry) { if (!isTrafficStatsAPISupported()) { return; } registerCachedGaugesForUploadedBytes(registry, false); registerCachedGaugeForDownloadedBytes(registry, false); registerCachedGaugesForUploadedBytes(registry, true); registerCachedGaugeForDownloadedBytes(registry, true); } }
NetworkUsageCollector implements Collector { @Override public void initialize(MetricRegistry registry) { if (!isTrafficStatsAPISupported()) { return; } registerCachedGaugesForUploadedBytes(registry, false); registerCachedGaugeForDownloadedBytes(registry, false); registerCachedGaugesForUploadedBytes(registry, true); registerCachedGaugeForDownloadedBytes(registry, true); } NetworkUsageCollector(AppTrafficStats appTrafficStats, MetricNamesGenerator metricNamesGenerator,
      long samplingInterval, TimeUnit timeUnit, App app); }
NetworkUsageCollector implements Collector { @Override public void initialize(MetricRegistry registry) { if (!isTrafficStatsAPISupported()) { return; } registerCachedGaugesForUploadedBytes(registry, false); registerCachedGaugeForDownloadedBytes(registry, false); registerCachedGaugesForUploadedBytes(registry, true); registerCachedGaugeForDownloadedBytes(registry, true); } NetworkUsageCollector(AppTrafficStats appTrafficStats, MetricNamesGenerator metricNamesGenerator,
      long samplingInterval, TimeUnit timeUnit, App app); @Override void initialize(MetricRegistry registry); }
NetworkUsageCollector implements Collector { @Override public void initialize(MetricRegistry registry) { if (!isTrafficStatsAPISupported()) { return; } registerCachedGaugesForUploadedBytes(registry, false); registerCachedGaugeForDownloadedBytes(registry, false); registerCachedGaugesForUploadedBytes(registry, true); registerCachedGaugeForDownloadedBytes(registry, true); } NetworkUsageCollector(AppTrafficStats appTrafficStats, MetricNamesGenerator metricNamesGenerator,
      long samplingInterval, TimeUnit timeUnit, App app); @Override void initialize(MetricRegistry registry);  }