### Question:
SpeedCalculator { public String speed() { return humanReadableSpeed(getBytesPerSecondAndFlush(), true); }  synchronized void reset(); synchronized void downloading(long increaseBytes); synchronized void flush(); long getInstantBytesPerSecondAndFlush(); synchronized long getBytesPerSecondAndFlush(); synchronized long getBytesPerSecondFromBegin(); synchronized void endTask(); String instantSpeed(); String speed(); String lastSpeed(); synchronized long getInstantSpeedDurationMillis(); String getSpeedWithBinaryAndFlush(); String getSpeedWithSIAndFlush(); String averageSpeed(); String speedFromBegin();  }### Answer:
@Test public void speed() { long now = 66; doReturn(now).when(calculator).nowMillis(); calculator.downloading(1000); now = 565; doReturn(now).when(calculator).nowMillis(); assertThat(calculator.speed()).isEqualTo("0 B/s"); now = 566; doReturn(now).when(calculator).nowMillis(); assertThat(calculator.speed()).isEqualTo("2.0 kB/s"); now = 1066; doReturn(now).when(calculator).nowMillis(); assertThat(calculator.speed()).isEqualTo("2.0 kB/s"); }