@Test public void testInsert() { logger.info("Testing insertion."); // Test insert a category. String tmpCategory = "Category 05"; CategoryBean category = new CategoryBean(); category.setDescription(String.format("Description of the %s.", tmpCategory)); category.setName(String.format("Name %s.", tmpCategory)); Long idCategory = serviceFactory.getCategoryService().insert(category); // Test insert a product. String tmpProduct = "Product 05"; ProductBean product = new ProductBean(); product.setDescription(String.format("Description of the %s.", tmpProduct)); product.setName(String.format("Name %s.", tmpProduct)); product.setPrice(12.02d); product.setCategory(new CategoryBean(idCategory)); serviceFactory.getProductServices().insert(product); }
@Test public void testFindAll() { logger.info("Find all registers."); // Find all categories. List<CategoryBean> categories = serviceFactory.getCategoryService().findAllCategories(); for (CategoryBean category : categories) { logger.info(String.format("Category [%s]", category)); } // Find all products. List<ProductBean> products = serviceFactory.getProductServices().findAllProducts(); for (ProductBean product : products) { logger.info(String.format("Product [%s]", product)); } }