EVCacheImpl extends AbstractValueAdaptingCache implements EVCache { @Override protected Object lookup(final Object key) { return doGet(toEVCacheKey(key)); } EVCacheImpl(final String name,
                       final com.netflix.evcache.EVCache cache,
                       final boolean allowNullValues,
                       final int striped,
                       final boolean deleteWhitespaceKey); @Override String getName(); @Override com.netflix.evcache.EVCache getNativeCache(); @SuppressWarnings("unchecked") @Override T get(final Object key, final Callable<T> valueLoader); @Override void put(final Object key, final Object value); @Override ValueWrapper putIfAbsent(final Object key, final Object value); @Override void evict(final Object key); @Override void clear();  }
@Test void should_be_thrown_EVCacheInvalidKeyException_when_lookup_key_is_null() { assertThatThrownBy(() -> cache.lookup(null)).isExactlyInstanceOf(EVCacheInvalidKeyException.class); }
@Test void should_be_thrown_EVCacheInvalidKeyException_when_key_is_null() { assertThatThrownBy(() -> cache.lookup(null)).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be null"); }
@Test void should_be_thrown_EVCacheInvalidKeyException_when_key_is_empty() { assertThatThrownBy(() -> cache.lookup("")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be empty"); }
@Test void should_be_thrown_EVCacheInvalidKeyException_when_key_contain_whitespace() { assertThatThrownBy(() -> cache.lookup(" ")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be contain whitespace"); assertThatThrownBy(() -> cache.lookup("a b")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be contain whitespace"); assertThatThrownBy(() -> cache.lookup("ab ")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be contain whitespace"); assertThatThrownBy(() -> cache.lookup(" ab")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Key must not be contain whitespace"); }
@Test void should_be_thrown_EVCacheInvalidKeyException_when_key_contain_whitespace_with_deleteWhitespaceKey() { cache = new EVCacheImpl("name", source, true, 10, true); assertThatThrownBy(() -> cache.lookup(" ")).isExactlyInstanceOf(EVCacheInvalidKeyException.class) .hasMessage("Deleted whitespace key is empty"); }