### Question:
MemcachedItemCache implements ItemCache { @Override public void putItem(final String key, final Object item, final long expire) { if (expire < Integer.MIN_VALUE || expire > Integer.MAX_VALUE) { throw new IllegalArgumentException(expire + " cannot be cast to int without changing its value."); } memcachedClient.set(key, (int) expire, item); } MemcachedItemCache(final MemcachedClient memcachedClient); @Override Object getItem(final String key, final long timeout); @Override void putItem(final String key, final Object item, final long expire);  }### Answer:
@Test public void shouldPutItem() { final String key = Randoms.randomString(); final String item = Randoms.randomString(); final long expire = Randoms.randomInt(5) + 1; memcachedItemCache.putItem(key, item, expire); verify(memcachedClient).set(key, (int) expire, item); }
@Test public void shouldNotPutItem_failExpireToLarge() { final String key = Randoms.randomString(); final String item = Randoms.randomString(); final long expire = (long) Integer.MAX_VALUE + 1; IllegalArgumentException actualException = null; try { memcachedItemCache.putItem(key, item, expire); } catch (final IllegalArgumentException e) { actualException = e; } assertNotNull(actualException); }