@Test
    public void testGetList() throws Exception {
        Set<Product> products = new HashSet<Product>();
        products.add(new Product(0, "desc0", "cat0"));
        products.add(new Product(1, "desc1", "cat0"));
        products.add(new Product(2, "desc2", "cat1"));
        products.add(new Product(3, "desc3", "cat1"));
        products.add(new Product(4, "desc3", "cat1"));

        for(Product product : products)
        {
            database.persistProduct(product);
        }

        Set<Product> productsExpected = new HashSet<Product>(products);
        List<Product> storedProducts = database.getList(null, new Db2Product(), Tables.PRODUCTS, Tables.PRODUCTS);
        for(Product storedProduct : storedProducts)
        {
            productsExpected.remove(storedProduct);
        }
        assertTrue(productsExpected.size() == 0);

        //with filter
        Set<Product> productsNotExpected = new HashSet<Product>(products);
        storedProducts = database.getList(cat1Filter, new Db2Product(), Tables.PRODUCTS, Tables.PRODUCTS);
        for(Product storedProduct : storedProducts)
        {
            productsNotExpected.remove(storedProduct);
        }
        assertTrue(productsNotExpected.size() == 2);

        //with sort
        storedProducts = database.getList(null, new Db2Product(), Tables.PRODUCTS, Tables.PRODUCTS, new FieldSortOrder(Tables.Products.DESC, SortOrder.ASC));
        assertEquals(storedProducts.get(0).getDescription(), "desc0");
        assertEquals(storedProducts.get(1).getDescription(), "desc1");
        assertEquals(storedProducts.get(2).getDescription(), "desc2");
        assertEquals(storedProducts.get(3).getDescription(), "desc3");
        assertEquals(storedProducts.get(4).getDescription(), "desc3");

        storedProducts = database.getList(null, new Db2Product(), Tables.PRODUCTS, Tables.PRODUCTS, new FieldSortOrder(Tables.Products.DESC, SortOrder.DESC));
        assertEquals(storedProducts.get(0).getDescription(), "desc3");
        assertEquals(storedProducts.get(1).getDescription(), "desc3");
        assertEquals(storedProducts.get(2).getDescription(), "desc2");
        assertEquals(storedProducts.get(3).getDescription(), "desc1");
        assertEquals(storedProducts.get(4).getDescription(), "desc0");
    }