### Question:
LicenseService { public static License create(final Context context, final String licenseeNumber, final String licenseTemplateNumber, final String transactionNumber, final License license) throws NetLicensingException { CheckUtils.paramNotNull(license, "license"); final Form form = license.asRequestForm(); if (StringUtils.isNotBlank(licenseeNumber)) { form.param(Constants.Licensee.LICENSEE_NUMBER, licenseeNumber); } if (StringUtils.isNotBlank(licenseTemplateNumber)) { form.param(Constants.LicenseTemplate.LICENSE_TEMPLATE_NUMBER, licenseTemplateNumber); } if (StringUtils.isNotBlank(transactionNumber)) { form.param(Constants.Transaction.TRANSACTION_NUMBER, transactionNumber); } return NetLicensingService.getInstance().post(context, Constants.License.ENDPOINT_PATH, form, License.class); }  static License create(final Context context, final String licenseeNumber,
            final String licenseTemplateNumber,
            final String transactionNumber, final License license); static License get(final Context context, final String number); static Page<License> list(final Context context, final String filter); static License update(final Context context, final String number, final String transactionNumber,
            final License license); static void delete(final Context context, final String number, final boolean forceCascade);  }### Answer:
@Test public void testCreate() throws Exception { final License newLicense = new LicenseImpl(); newLicense.setNumber("LC001-TEST"); newLicense.setActive(false); newLicense.setName("Concrete Test License"); newLicense.setPrice(new BigDecimal(20)); newLicense.setCurrency(Currency.EUR); newLicense.setHidden(false); newLicense.addProperty(LICENSE_CUSTOM_PROPERTY, "Custom property value"); final License createdLicense = LicenseService.create(context, "L001-TEST", "LT001-TEST", null, newLicense); assertNotNull(createdLicense); assertEquals("LC001-TEST", createdLicense.getNumber()); assertEquals(false, createdLicense.getActive()); assertEquals("Concrete Test License", createdLicense.getName()); assertEquals(new BigDecimal("10.00"), createdLicense.getPrice()); assertEquals(Currency.EUR, createdLicense.getCurrency()); assertEquals(true, createdLicense.getHidden()); assertEquals("L001-TEST", createdLicense.getLicensee().getNumber()); assertEquals("LT001-TEST", createdLicense.getLicenseTemplate().getNumber()); assertEquals("Custom property value", createdLicense.getProperties().get(LICENSE_CUSTOM_PROPERTY)); }
@Test public void testCreateEmpty() throws Exception { final License newLicense = new LicenseImpl(); final License createdLicense = LicenseService.create(context, "L001-TEST", "LT001-TEST", null, newLicense); assertNotNull(createdLicense); assertEquals(true, createdLicense.getActive()); assertEquals("Test License", createdLicense.getName()); assertEquals(new BigDecimal("10.00"), createdLicense.getPrice()); assertEquals(Currency.EUR, createdLicense.getCurrency()); assertEquals(true, createdLicense.getHidden()); assertEquals("L001-TEST", createdLicense.getLicensee().getNumber()); assertEquals("LT001-TEST", createdLicense.getLicenseTemplate().getNumber()); }
@Test public void testCreateWithoutLicenseeNumber() throws Exception { thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: Licensee number is not provided"); LicenseService.create(context, null, null, null, new LicenseImpl()); }
@Test public void testCreateWithoutLicenseTemplateNumber() throws Exception { thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: License template number is not provided"); LicenseService.create(context, "L001-TEST", null, null, new LicenseImpl()); }