### Question:
RocksdbKVStore implements KVStore<K, V> { @Override public synchronized KVIterator<K, V> range(K from, K to) { checkStoreOpen(); RocksIterator rocksIter = db.newIterator(dataCfHandle); if (null == from) { rocksIter.seekToFirst(); } else { byte[] fromBytes = keyCoder.encode(from); rocksIter.seek(fromBytes); } KVIterator<K, V> kvIter; if (null == to) { kvIter = new RocksdbKVIterator(name, rocksIter, keyCoder, valCoder); } else { kvIter = new RocksdbRangeIterator(name, rocksIter, keyCoder, valCoder, to); } kvIters.add(kvIter); return kvIter; } RocksdbKVStore(); @VisibleForTesting synchronized RocksDB getDb(); @Override synchronized String name(); @Override synchronized void checkpoint(); @Override long getLastRevision(); @Override @SuppressWarnings("unchecked") synchronized void init(StateStoreSpec spec); @Override synchronized void flush(); @Override synchronized void close(); @Override synchronized V get(K key); @Override synchronized KVIterator<K, V> range(K from, K to); @Override synchronized void put(K key, V value); @Override V putIfAbsent(K key, V value); @Override synchronized KVMulti<K, V> multi(); @Override synchronized V delete(K key);  }### Answer:
@Test(expected = InvalidStateStoreException.class) public void testRangeBeforeInit() throws Exception { store.range("key1", "key2"); }
@Test(expected = InvalidStateStoreException.class) public void testRangeAfterClose() throws Exception { initThenClose(); store.range("key1", "key2"); }