1
package net.sf.ehcache.store;
3
import net.sf.ehcache.Cache;
4
import net.sf.ehcache.Element;
5
import net.sf.ehcache.config.CacheConfiguration;
6
import net.sf.ehcache.pool.impl.UnboundedPool;
9
import static org.hamcrest.Matchers.equalTo;
10
import static org.hamcrest.Matchers.notNullValue;
11
import static org.junit.Assert.assertThat;
16
public class MemoryOnlyStoreTest {
19
public void testSetsMemoryEvictionPolicy() {
20
final String name = "FAKE!";
21
Store store = MemoryOnlyStore.create(new Cache(new CacheConfiguration("fakeCache", 100)), new UnboundedPool());
22
store.setInMemoryEvictionPolicy(new AbstractPolicy() {
23
public String getName() {
27
public boolean compare(final Element element1, final Element element2) {
31
final Policy inMemoryEvictionPolicy = store.getInMemoryEvictionPolicy();
32
assertThat(inMemoryEvictionPolicy, notNullValue());
33
assertThat(inMemoryEvictionPolicy.getName(), equalTo(name));