@Test
void buildPolicyEntityTestGlobal() {

    PolicyEntityBuilder policyEntityBuilder = new PolicyEntityBuilder(DocumentTools.INSTANCE, new IdGenerator(), policyXMLBuilder);
    Policy policyToBuild = new Policy();
    policyToBuild.setPath("my/policy/global.xml");
    policyToBuild.setName("global.xml");
    policyToBuild.setId("global-policy-id");
    policyToBuild.setGuid("global-policy-guid-123");
    policyToBuild.setTag("global-policy");
    policyToBuild.setPolicyType(PolicyType.GLOBAL);
    Folder myFolder = new Folder();
    myFolder.setId("myId");
    myFolder.setName("my");
    myFolder.setParentFolder(Folder.ROOT_FOLDER);
    Folder parentFolder = new Folder();
    parentFolder.setId("folder-id");
    parentFolder.setName("policy");
    parentFolder.setParentFolder(myFolder);
    policyToBuild.setParentFolder(parentFolder);
    Entity policyEntity = policyEntityBuilder.buildPolicyEntity(policyToBuild, null, bundle, document);
    assertEquals(policyToBuild.getId(), policyEntity.getId());
    assertEquals(policyToBuild.getPath(), policyEntity.getName());
    assertNotNull(policyEntity.getXml());
    Element policyDetail = getSingleChildElement(policyEntity.getXml(), POLICY_DETAIL);
    assertNotNull(policyDetail);
    String type = getSingleChildElementTextContent(policyDetail, POLICY_TYPE);
    assertNotNull(type);
    assertEquals(PolicyType.GLOBAL.getType(), type);
    final Map<String, Object> properties = mapPropertiesElements(getSingleChildElement(policyDetail, PROPERTIES), PROPERTIES);
    assertFalse(properties.isEmpty());
    assertEquals("global-policy", properties.get(PropertyConstants.PROPERTY_TAG));
    assertNull(properties.get(PropertyConstants.PROPERTY_SUBTAG));
}