### Question:
ProductService { public static Product create(final Context context, final Product product) throws NetLicensingException { CheckUtils.paramNotNull(product, "product"); return NetLicensingService.getInstance().post(context, Constants.Product.ENDPOINT_PATH, product.asRequestForm(), Product.class); }  static Product create(final Context context, final Product product); static Product get(final Context context, final String number); static Page<Product> list(final Context context, final String filter); static Product update(final Context context, final String number, final Product product); static void delete(final Context context, final String number, final boolean forceCascade);  }### Answer:
@Test public void testCreate() throws Exception { final Product newProduct = new ProductImpl(); newProduct.setName("Test Product"); newProduct.setNumber("P001-TEST"); newProduct.setActive(true); newProduct.setVersion("v3.2"); newProduct.setLicenseeAutoCreate(true); newProduct.setDescription("Test Product description"); newProduct.addProperty(PRODUCT_CUSTOM_PROPERTY, "Test Value"); final Product createdProduct = ProductService.create(context, newProduct); assertNotNull(createdProduct); assertEquals("Test Product", createdProduct.getName()); assertEquals("P001-TEST", createdProduct.getNumber()); assertEquals(true, createdProduct.getActive()); assertEquals("v3.2", createdProduct.getVersion()); assertEquals(true, createdProduct.getLicenseeAutoCreate()); assertEquals("Test Product description", createdProduct.getDescription()); assertEquals("Test Value", createdProduct.getProperties().get(PRODUCT_CUSTOM_PROPERTY)); }
@Test public void testCreateEmpty() throws Exception { thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: Product name is required"); final Product newProduct = new ProductImpl(); ProductService.create(context, newProduct); }
@Test public void testCreateWithNameOnly() throws Exception { final Product newProduct = new ProductImpl(); newProduct.setName("Test Product"); final Product createdProduct = ProductService.create(context, newProduct); assertNotNull(createdProduct); assertEquals("Test Product", createdProduct.getName()); assertEquals(true, createdProduct.getActive()); assertEquals("", createdProduct.getVersion()); assertEquals(false, createdProduct.getLicenseeAutoCreate()); }