@Test
void linkPortalTemplateDisabledFlag() throws DocumentParseException {

    Bundle fullBundle = new Bundle();
    myEncass.setProperties(new HashMap<String, Object>() {{
        put(PALETTE_FOLDER, DEFAULT_PALETTE_FOLDER_LOCATION);
    }});
    fullBundle.addEntity(myEncass);
    fullBundle.addEntity(createPolicy("myEncassPolicy", "1","1", "1", DocumentUtils.stringToXML(DocumentTools.INSTANCE, ENCASS_POLICY_WITH_PORTAL_INTEGRATION_DISABLED), EMPTY));
    fullBundle.addEntity(createFolder("myFolder", "1", null));
    FolderTree folderTree = new FolderTree(fullBundle.getEntities(Folder.class).values());
    fullBundle.setFolderTree(folderTree);
    encassLinker.link(bundle, fullBundle);
    Encass linkedEncass = bundle.getEntities(Encass.class).get("1");
    assertEquals("myEncassPolicy", linkedEncass.getPath());
    assertEquals(2, linkedEncass.getProperties().size());
    assertFalse(Boolean.valueOf(linkedEncass.getProperties().get(L7_TEMPLATE).toString()));
    Policy updatedPolicy =  fullBundle.getEntities(Policy.class).get("1");
    assertThrows(DocumentParseException.class, () -> getSingleElement(updatedPolicy.getPolicyDocument(), API_PORTAL_ENCASS_INTEGRATION));
}