~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/test/java/net/sf/ehcache/store/MemoryOnlyStoreTest.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package net.sf.ehcache.store;
 
2
 
 
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;
 
7
import org.junit.Test;
 
8
 
 
9
import static org.hamcrest.Matchers.equalTo;
 
10
import static org.hamcrest.Matchers.notNullValue;
 
11
import static org.junit.Assert.assertThat;
 
12
 
 
13
/**
 
14
 * @author Alex Snaps
 
15
 */
 
16
public class MemoryOnlyStoreTest {
 
17
 
 
18
    @Test
 
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() {
 
24
                return name;
 
25
            }
 
26
 
 
27
            public boolean compare(final Element element1, final Element element2) {
 
28
                return false;
 
29
            }
 
30
        });
 
31
        final Policy inMemoryEvictionPolicy = store.getInMemoryEvictionPolicy();
 
32
        assertThat(inMemoryEvictionPolicy, notNullValue());
 
33
        assertThat(inMemoryEvictionPolicy.getName(), equalTo(name));
 
34
    }
 
35
}