### Question:
LicenseUtils { public static void grantLicense(Context context, Item item, String licenseText) throws SQLException, IOException, AuthorizeException { byte[] licenseBytes = licenseText.getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(licenseBytes); Bitstream b = item.createSingleBitstream(bais, "LICENSE"); b.setName("license.txt"); b.setSource("Written by org.dspace.content.LicenseUtils"); BitstreamFormat bf = BitstreamFormat.findByShortDescription(context, "License"); b.setFormat(bf); b.update(); }  static String getLicenseText(Locale locale, Collection collection,
            Item item, EPerson eperson, Map<String, Object> additionalInfo); static String getLicenseText(Locale locale, Collection collection,
            Item item, EPerson eperson); static void grantLicense(Context context, Item item,
            String licenseText);  }### Answer:
@Test public void testGrantLicense() throws Exception { context.turnOffAuthorisationSystem(); Item item = Item.create(context); String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense(); LicenseUtils.grantLicense(context, item, defaultLicense); StringWriter writer = new StringWriter(); IOUtils.copy(item.getBundles("LICENSE")[0].getBitstreams()[0].retrieve(), writer); String license = writer.toString(); assertThat("testGrantLicense 0",license, equalTo(defaultLicense)); context.restoreAuthSystemState(); }