### Question:
SystemClock implements Clock { @Override public long getElapsedTimeInNanos(Location location) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return location.getElapsedRealtimeNanos(); } return location.getTime() * MS_TO_NS; }  @Override long getSystemElapsedTimeInNanos(); @Override long getElapsedTimeInNanos(Location location);  }### Answer:
@Test @Config(sdk = 17) public void getTimeInNanos_shouldReturnElapsedRealtimeNanosForSdk17AndUp() throws Exception { final long nanos = 1000000; final Location location = new Location("mock"); location.setElapsedRealtimeNanos(nanos); assertThat(clock.getElapsedTimeInNanos(location)).isEqualTo(nanos); }
@Test @Config(sdk = 16) public void getTimeInNanos_shouldUseUtcTimeInMillisForSdk16AndLower() throws Exception { final long millis = 1000; final Location location = new Location("mock"); location.setTime(millis); assertThat(clock.getElapsedTimeInNanos(location)).isEqualTo(millis * MS_TO_NS); }