@Test
public void testGrantLicense() throws Exception
{

    context.turnOffAuthorisationSystem();
    Collection collection = collectionService.create(context, owningCommunity);
    Item item = installItemService.installItem(context, workspaceItemService.create(context, collection, false));
    String defaultLicense = licenseService.getDefaultSubmissionLicense();
    LicenseUtils.grantLicense(context, item, defaultLicense);
    StringWriter writer = new StringWriter();
    IOUtils.copy(bitstreamService.retrieve(context, itemService.getBundles(item, "LICENSE").get(0).getBitstreams().get(0)), writer);
    String license = writer.toString();
    assertThat("testGrantLicense 0",license, equalTo(defaultLicense));
    context.restoreAuthSystemState();
}