### Question:
ProductModuleService { public static ProductModule create(final Context context, final String productNumber, final ProductModule productModule) throws NetLicensingException { CheckUtils.paramNotNull(productModule, "productNumber"); final Form form = productModule.asRequestForm(); if (StringUtils.isNotBlank(productNumber)) { form.param(Constants.Product.PRODUCT_NUMBER, productNumber); } return NetLicensingService.getInstance().post(context, Constants.ProductModule.ENDPOINT_PATH, form, ProductModule.class); }  static ProductModule create(final Context context, final String productNumber,
            final ProductModule productModule); static ProductModule get(final Context context, final String number); static Page<ProductModule> list(final Context context, final String filter); static ProductModule update(final Context context, final String number, final ProductModule productModule); static void delete(final Context context, final String number, final boolean forceCascade);  }### Answer:
@Test public void testCreate() throws Exception { final ProductModule newModule = new ProductModuleImpl(); newModule.setNumber("PM001-TEST"); newModule.setActive(true); newModule.setName("Test Product Module"); newModule.setLicensingModel(Constants.LicensingModel.Rental.NAME); newModule.addProperty(Constants.LicensingModel.Rental.YELLOW_THRESHOLD, "10"); newModule.addProperty(Constants.LicensingModel.Rental.RED_THRESHOLD, "3"); final ProductModule createdModule = ProductModuleService.create(context, "P001-TEST", newModule); assertNotNull(createdModule); assertEquals("PM001-TEST", createdModule.getNumber()); assertEquals(true, createdModule.getActive()); assertEquals("Test Product Module", createdModule.getName()); assertEquals(Constants.LicensingModel.Rental.NAME, createdModule.getLicensingModel()); assertEquals("P001-TEST", createdModule.getProduct().getNumber()); assertEquals("10", createdModule.getProperties().get(Constants.LicensingModel.Rental.YELLOW_THRESHOLD)); assertEquals("3", createdModule.getProperties().get(Constants.LicensingModel.Rental.RED_THRESHOLD)); }
@Test public void testCreateWithoutProductNumber() throws Exception { thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: Product number is not provided"); ProductModuleService.create(context, null, new ProductModuleImpl()); }
@Test public void testCreateEmpty() throws Exception { thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: Product module name is required"); final ProductModule newModule = new ProductModuleImpl(); ProductModuleService.create(context, "P001-TEST", newModule); }
@Test public void testCreateWithRequiredPropertiesOnly() throws Exception { final ProductModule newModule = new ProductModuleImpl(); newModule.setName("Test Product Module"); newModule.setLicensingModel(Constants.LicensingModel.TryAndBuy.NAME); final ProductModule createdModule = ProductModuleService.create(context, "P001-TEST", newModule); assertNotNull(createdModule); assertEquals(true, createdModule.getActive()); }