serverCacheManager.clear(Country.class);
ServerCache beanCache = serverCacheManager.getBeanCache(Country.class);
Assert.assertEquals(0, beanCache.size());
Country nz1 = Ebean.getReference(Country.class, "NZ");
Assert.assertEquals(0, beanCache.size());
// has the effect of loading the cache via lazy loading
nz1.getName();
Assert.assertEquals(1, beanCache.size());
Country nz2 = Ebean.getReference(Country.class, "NZ");
Country nz2b = Ebean.getReference(Country.class, "NZ");
Country nz3 = Ebean.find(Country.class, "NZ");
Country nz4 = Ebean.find(Country.class).setId("NZ").setAutofetch(false).setUseCache(false)
.findUnique();
Assert.assertTrue(nz2 == nz2b);
Assert.assertTrue(nz2 == nz3);
Assert.assertTrue(nz3 != nz4);