### Question:
RDBStoreIterator implements TableIterator<byte[], ByteArrayKeyValue> { @Override public byte[] key() { if (rocksDBIterator.isValid()) { return rocksDBIterator.key(); } return null; } RDBStoreIterator(RocksIterator iterator);  RDBStoreIterator(RocksIterator iterator, RDBTable table); @Override void forEachRemaining(
      Consumer<? super ByteArrayKeyValue> action); @Override boolean hasNext(); @Override ByteArrayKeyValue next(); @Override void seekToFirst(); @Override void seekToLast(); @Override ByteArrayKeyValue seek(byte[] key); @Override byte[] key(); @Override ByteArrayKeyValue value(); @Override void removeFromDB(); @Override void close();  }### Answer:
@Test public void testGettingTheKeyIfIteratorIsValid() { when(rocksDBIteratorMock.isValid()).thenReturn(true); when(rocksDBIteratorMock.key()).thenReturn(new byte[]{0x00}); RDBStoreIterator iter = new RDBStoreIterator(rocksDBIteratorMock); byte[] key = iter.key(); InOrder verifier = inOrder(rocksDBIteratorMock); verifier.verify(rocksDBIteratorMock, times(1)).isValid(); verifier.verify(rocksDBIteratorMock, times(1)).key(); assertArrayEquals(new byte[]{0x00}, key); }