### Question:
NamedCache { synchronized void put(final Bytes key, final LRUCacheEntry value) { if (!value.isDirty() && dirtyKeys.contains(key)) { throw new IllegalStateException(String.format("Attempting to put a clean entry for key [%s] " + "into NamedCache [%s] when it already contains " + "a dirty entry for the same key", key, name)); } LRUNode node = cache.get(key); if (node != null) { numOverwrites++; currentSizeBytes -= node.size(); node.update(value); updateLRU(node); } else { node = new LRUNode(key, value); putHead(node); cache.put(key, node); } if (value.isDirty()) { dirtyKeys.remove(key); dirtyKeys.add(key); } currentSizeBytes += node.size(); } NamedCache(final String name, final StreamsMetrics metrics); long size();  }### Answer:
@Test(expected = IllegalStateException.class) public void shouldThrowIllegalStateExceptionWhenTryingToOverwriteDirtyEntryWithCleanEntry() throws Exception { cache.put(Bytes.wrap(new byte[]{0}), new LRUCacheEntry(new byte[]{10}, true, 0, 0, 0, "")); cache.put(Bytes.wrap(new byte[]{0}), new LRUCacheEntry(new byte[]{10}, false, 0, 0, 0, "")); }