DeletedConsumerCurator extends AbstractHibernateCurator<DeletedConsumer> { @SuppressWarnings("unchecked") public CandlepinQuery<DeletedConsumer> findByDate(Date date) { DetachedCriteria criteria = DetachedCriteria.forClass(DeletedConsumer.class) .add(Restrictions.ge("created", date)) .addOrder(Order.desc("created")); return this.cpQueryFactory.<DeletedConsumer>buildQuery(this.currentSession(), criteria); } DeletedConsumerCurator(); DeletedConsumer findByConsumer(Consumer c); DeletedConsumer findByConsumerUuid(String uuid); CandlepinQuery<DeletedConsumer> findByOwner(Owner o); @SuppressWarnings("unchecked") CandlepinQuery<DeletedConsumer> findByOwnerId(String oid); int countByConsumer(Consumer c); int countByConsumerUuid(String uuid); @SuppressWarnings("unchecked") CandlepinQuery<DeletedConsumer> findByDate(Date date);  }
@Test public void findByDate() throws InterruptedException { assertEquals(2, dcc.findByDate(twoResultsDate).list().size()); assertEquals(1, dcc.findByDate(oneResultDate).list().size()); Thread.sleep(2000); assertEquals(0, dcc.findByDate(new Date()).list().size()); }
@Test public void descOrderByDate() { DeletedConsumer newest = dcc.findByDate(twoResultsDate).list().get(0); assertEquals("klmno", newest.getConsumerUuid()); }