### Question:
Cache { public V get(K key) { final V result = itemMap.get(key); if (result == null) { throw new IllegalArgumentException("Object with key '" + key + "' not contained in cache"); } return result; } Cache(int capacity); V add(K key, V item); boolean contains(K key); V get(K key); Collection<V> clear(); V remove(K key);  }### Answer:
@Test public void testGetWithInvalidKeyThrows() { try { cache.get(24); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException expected) { } }