@Test public void testValidateProduct() { // For Test 1 = None of the values can be empty for (Product p : products) { System.out.println("\n" + p.getProductId()); } assertEquals(ProductService.validateProduct(products.get(0)), Constants.ALL_FIELDS_REQUIRED); // For Test 2 = Price should be greater than zero assertEquals( ProductService.validateProduct(products.get(1)), Utility.getPropertyValue(Constants.pricemorethanzero)); // For Test 3 = Non negative values assertEquals( ProductService.validateProduct(products.get(2)), Utility.getPropertyValue(Constants.msgnotNegative)); }
@Test public void testGenerateProductID() { Category category = (new CategoryDao()).get("MUG"); String newPID = ProductService.generateProductID(category); assertEquals("MUG/4", newPID); }