示例#1
0
 @Test
 @Transactional
 public void testCountQuery() {
   Filter f = new BeanFilter("joinFilter");
   Page<Book> p = new Page<Book>();
   p.setFilter(f);
   bookDao.getPage(p);
   assertEquals(22, p.getCount());
 }
示例#2
0
 @Test
 @Transactional
 public void testFilter() {
   BookFilter bf = new BookFilter("bookFilter");
   bf.setCategory(new Category("Java"));
   Page<Book> page = new Page<Book>(10);
   page.setFilter(bf);
   bookDao.getPage(page);
   List<Book> books = page.getData();
   assertEquals(10, books.size());
 }
示例#3
0
 @Test
 @Transactional
 public void testNamedQuery() {
   BookFilter filter = new BookFilter("booksByAuthorName");
   filter.setAuthorName("Martin");
   Page<Book> page = new Page<Book>();
   page.setFilter(filter);
   page.setSortName("publishedDate");
   page.setOrderDesc();
   bookDao.getPage(page);
   assertEquals(4, page.getData().size());
 }