@Test public void testTimes() { ShadowSystemClock.setUptimeMillis(1234); ShadowSystemClock.setElapsedRealtime(9876); TimeMetrics snapshot = new TimeMetrics(); TimeMetricsCollector collector = new TimeMetricsCollector(); collector.getSnapshot(snapshot); assertThat(snapshot.uptimeMs).isEqualTo(1234); assertThat(snapshot.realtimeMs).isEqualTo(9876); }
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; }
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; } }
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; }  }
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; }  @Override @ThreadSafe(enableChecks = false) boolean getSnapshot(TimeMetrics snapshot); @Override TimeMetrics createMetrics(); }
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; }  @Override @ThreadSafe(enableChecks = false) boolean getSnapshot(TimeMetrics snapshot); @Override TimeMetrics createMetrics();  }