### Question:
TransportStats { void registerConnectionTime(ComponentName transportComponent, long timeMs) { synchronized (mStatsLock) { Stats stats = mTransportStats.get(transportComponent); if (stats == null) { stats = new Stats(); mTransportStats.put(transportComponent, stats); } stats.register(timeMs); } }  @Nullable Stats getStatsForTransport(ComponentName transportComponent); void dump(PrintWriter pw);  }### Answer:
@Test public void testRegisterConnectionTime() { mTransportStats.registerConnectionTime(mTransportComponent1, 50L); Stats stats = mTransportStats.getStatsForTransport(mTransportComponent1); assertThat(stats.average).isWithin(TOLERANCE).of(50); assertThat(stats.max).isEqualTo(50L); assertThat(stats.min).isEqualTo(50L); assertThat(stats.n).isEqualTo(1); }