### Question:
MetaRangeImpl implements MetaRange { @Override public CompletableFuture<ServingState> updateServingState(ServingState state) { return checkStreamCreated(() -> { long mTime = System.currentTimeMillis(); byte[] streamMetadataKey = getStreamMetadataKey(streamId); byte[] streamMetadata = toStreamMetadata(state, mTime).toByteArray(); return store.rPut(streamMetadataKey, streamMetadata, revision) .thenApplyAsync(newRev -> { this.servingState = state; this.mTime = mTime; this.revision = newRev; return state; }, executor); }); } MetaRangeImpl(MVCCAsyncStore<byte[], byte[]> store,
                         ExecutorService executor,
                         StorageContainerPlacementPolicy placementPolicy); private  MetaRangeImpl(MVCCAsyncStore<byte[], byte[]> store,
                          ExecutorService executor,
                          StorageContainerPlacementPolicy placementPolicy,
                          NavigableMap<Long, RangeMetadata> ranges,
                          List<Long> currentRanges,
                          StreamMetadata meta,
                          long cTime,
                          long mTime); static final byte[] getStreamMetadataKey(long streamId); static final byte[] getStreamRangeKey(long streamId, long rangeId); static final byte[] getStreamMetadataEndKey(long streamId); static final boolean isMetadataKey(byte[] key); @VisibleForTesting long unsafeGetCreationTime(); @VisibleForTesting long unsafeGetModificationTime(); @VisibleForTesting LifecycleState unsafeGetLifecycleState(); @VisibleForTesting synchronized StreamProperties unsafeGetStreamProperties(); @VisibleForTesting synchronized long unsafeGetStreamId(); @VisibleForTesting NavigableMap<Long, RangeMetadata> unsafeGetRanges(); @VisibleForTesting List<Long> unsafeGetCurrentRanges(); @Override synchronized String getName(); @Override CompletableFuture<Boolean> create(StreamProperties streamProps); @Override CompletableFuture<MetaRange> load(long streamId); @Override CompletableFuture<Boolean> delete(long streamId); @Override CompletableFuture<ServingState> getServingState(); @Override CompletableFuture<ServingState> updateServingState(ServingState state); @Override CompletableFuture<StreamConfiguration> getConfiguration(); @Override CompletableFuture<List<RangeMetadata>> getActiveRanges();  }### Answer:
@Test public void testUpdateServingState() throws Exception { assertTrue(FutureUtils.result(this.metaRange.create(streamProps))); long mTime = this.metaRange.unsafeGetModificationTime(); assertEquals( ServingState.WRITABLE, FutureUtils.result(this.metaRange.getServingState())); long newTime = this.metaRange.unsafeGetModificationTime(); assertTrue(newTime >= mTime); mTime = newTime; assertEquals( ServingState.READONLY, FutureUtils.result(this.metaRange.updateServingState(ServingState.READONLY))); newTime = this.metaRange.unsafeGetModificationTime(); assertTrue(newTime >= mTime); }