### Question:
ThreadCache { public MemoryLRUCacheBytesIterator range(final String namespace, final Bytes from, final Bytes to) { final NamedCache cache = getCache(namespace); if (cache == null) { return new MemoryLRUCacheBytesIterator(Collections.<Bytes>emptyIterator(), new NamedCache(namespace, this.metrics)); } return new MemoryLRUCacheBytesIterator(cache.keyRange(from, to), cache); } ThreadCache(final String name, long maxCacheSizeBytes, final StreamsMetrics metrics); long puts(); long gets(); long evicts(); long flushes(); void addDirtyEntryFlushListener(final String namespace, DirtyEntryFlushListener listener); void flush(final String namespace); LRUCacheEntry get(final String namespace, Bytes key); void put(final String namespace, Bytes key, LRUCacheEntry value); LRUCacheEntry putIfAbsent(final String namespace, Bytes key, LRUCacheEntry value); void putAll(final String namespace, final List<KeyValue<Bytes, LRUCacheEntry>> entries); LRUCacheEntry delete(final String namespace, final Bytes key); MemoryLRUCacheBytesIterator range(final String namespace, final Bytes from, final Bytes to); MemoryLRUCacheBytesIterator all(final String namespace); long size();  }### Answer:
@Test(expected = NoSuchElementException.class) public void shouldThrowIfNoPeekNextKey() throws Exception { final ThreadCache cache = new ThreadCache("testCache", 10000L, new MockStreamsMetrics(new Metrics())); final ThreadCache.MemoryLRUCacheBytesIterator iterator = cache.range("", Bytes.wrap(new byte[]{0}), Bytes.wrap(new byte[]{1})); iterator.peekNextKey(); }
@Test public void shouldReturnFalseIfNoNextKey() throws Exception { final ThreadCache cache = new ThreadCache("testCache", 10000L, new MockStreamsMetrics(new Metrics())); final ThreadCache.MemoryLRUCacheBytesIterator iterator = cache.range("", Bytes.wrap(new byte[]{0}), Bytes.wrap(new byte[]{1})); assertFalse(iterator.hasNext()); }