### Question:
SimpleHashMap implements Iterable<SimpleHashMap.Entry<K, V>> { @Override public Iterator<Entry<K, V>> iterator() { return new Iterator<Entry<K, V>>() { private final int expectedModCount = modCount; private int position; private int findNextNotNullElement() { int result = -1; for (int i = this.position; i < mainStorage.length; i++) { if (mainStorage[i] != null) { result = i; break; } } return result; } @Override public boolean hasNext() { return (findNextNotNullElement() != -1); } @Override public Entry<K, V> next() { if (this.expectedModCount != modCount) { throw new ConcurrentModificationException(); } if (!hasNext()) { throw new NoSuchElementException(); } int nextNotNullElementIndex = findNextNotNullElement(); Entry<K, V> result = mainStorage[findNextNotNullElement()]; this.position = nextNotNullElementIndex + 1; return result; } }; } SimpleHashMap();  SimpleHashMap(int size); int getSize(); boolean insert(K key, V value); V get(K key); boolean delete(K key); @Override Iterator<Entry<K, V>> iterator();  }### Answer:
@Test(expected = NoSuchElementException.class) public void ifMapIsEmptyThenIteratorNextThrowNoSuchElementException() { Iterator<SimpleHashMap.Entry<User, String>> testIterator = testMap.iterator(); assertThat(testIterator.hasNext(), is(false)); testIterator.next(); }