EvictionDao extends HibernateDao<Eviction, Long> implements
      IEvictionDao { public Set<Product> getProducts () { Eviction eviction = getEviction (); return eviction.getProducts (); }  Eviction getFactoryDefault(); Eviction getEviction(); void update(EvictionStrategy strategy, int keep_period,
      int max_disk_usage); void setProducts(Set<Product> products); Set<Product> getProducts(); void removeProduct(Product product);  }
@Override @Test (dependsOnMethods = "read") public void create () { int value = 42; EvictionStrategy strategy = EvictionStrategy.LRU; Eviction eviction = createEviction (value, value, value, strategy); eviction = dao.create (eviction); eviction = dao.read (eviction.getId ()); assertEquals (dao.count (), (howMany () + 1)); assertNotNull (eviction); assertEquals (eviction.getKeepPeriod (), value); assertEquals (eviction.getMaxDiskUsage (), value); assertEquals (eviction.getMaxProductNumber (), value); assertEquals (eviction.getProducts (), getProducts ()); assertEquals (eviction.getStrategy (), strategy); }
@Override @Test public void read () { Eviction eviction = dao.read (1L); assertNotNull (eviction); assertEquals (eviction.getId (), Long.valueOf (1)); assertEquals (eviction.getKeepPeriod (), 10); assertEquals (eviction.getMaxDiskUsage (), 80); assertEquals (eviction.getMaxProductNumber (), 1000); assertEquals (eviction.getProducts ().size (), 0); assertEquals (eviction.getStrategy (), EvictionStrategy.NONE); }
@Override @Test (dependsOnMethods = { "read", "create" }) public void delete () { long id = 1; Eviction eviction = dao.read (id); Set<Product> ps = eviction.getProducts (); Hibernate.initialize (ps); dao.delete (eviction); assertEquals (dao.count (), (howMany () - 1)); assertNull (dao.read (id)); for (Product p : ps) { assertNotNull (pdao.read (p.getId ())); } }
@Test public void getProduct () { Set<Product> toEvict = dao.getProducts (); assertNotNull (toEvict); assertTrue (toEvict.isEmpty ()); }