@Test
void buildDeploymentBundleWithWrongGuidAndId() {

    Element policyElement = createElementWithAttributesAndChildren(
            document,
            "wsp:Policy",
            ImmutableMap.of("xmlns:L7p", "http://www.layer7tech.com/ws/policy", "xmlns:wsp", "http://schemas.xmlsoap.org/ws/2002/12/policy&quot"),
            createSetVariableAssertion(document, "var", "value"),
            createHardcodedAssertionElement(document, "response")
    );
    Element encassElement = createEncapsulatedAssertionElement(document, TEST_ENCASS, "encass");
    encassElement.setAttribute(EncapsulatedAssertionBuilder.ENCASS_NAME, TEST_ENCASS);
    policyElement.appendChild(encassElement);
    document.appendChild(policyElement);
    policy.setPolicyXML(DocumentTools.INSTANCE.elementToString(document.getDocumentElement()));
    policy.setParentFolder(Folder.ROOT_FOLDER);
    policy.setGuid("policyGuid");
    policy.setId("policyID");
    policy.setName(policy.getPath());
    Set<Annotation> annotations = new HashSet<>();
    Annotation annotation = new Annotation(AnnotationType.BUNDLE_HINTS);
    annotation.setGuid("");
    annotation.setId("");
    annotations.add(annotation);
    annotation = new Annotation(AnnotationType.SHARED);
    annotations.add(annotation);
    policy.setAnnotations(annotations);
    policy.setParentEntityShared(policy.isShared());
    Encass encass = new Encass();
    encass.setGuid("encassGuid");
    encass.setName(TEST_ENCASS);
    Annotation encassAnnotation = new Annotation(AnnotationType.SHARED);
    annotations = new HashSet<>();
    annotations.add(encassAnnotation);
    encass.setAnnotations(annotations);
    encass.setParentEntityShared(encass.isShared());
    bundle.getEncasses().put(TEST_ENCASS, encass);
    bundle.getPolicies().put("Policy", policy);
    AnnotatedEntity annotatedEntity = encass.getAnnotatedEntity();
    annotatedEntity.setEntityName(encass.getName());
    AnnotatedBundle annotatedBundle = new AnnotatedBundle(bundle, annotatedEntity, new ProjectInfo("", "", ""));
    annotatedBundle.putAllEncasses(org.testcontainers.shaded.com.google.common.collect.ImmutableMap.of(TEST_ENCASS, encass));
    annotatedBundle.getPolicies().put("Policy", policy);
    PolicyEntityBuilder builder = new PolicyEntityBuilder(DocumentTools.INSTANCE, new IdGenerator(), policyXMLBuilder);
    List<Entity> entities = builder.build(annotatedBundle, BundleType.DEPLOYMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument());
    assertFalse(entities.isEmpty());
    assertEquals(1, entities.size());
    Entity e = entities.get(0);
    assertEquals(EntityTypes.POLICY_TYPE, e.getType());
    assertEquals(e.getId(), "policyID");
    //wrong guid and id
    annotations = new HashSet<>();
    annotation = new Annotation(AnnotationType.SHARED);
    annotations.add(annotation);
    annotation = new Annotation(AnnotationType.BUNDLE_HINTS);
    annotation.setGuid("wrongGuid");
    annotation.setId("wrongId");
    annotations.add(annotation);
    policy.setAnnotations(annotations);
    policy.setAnnotatedEntity(null);
    builder = new PolicyEntityBuilder(DocumentTools.INSTANCE, new IdGenerator(), policyXMLBuilder);
    entities = builder.build(annotatedBundle, BundleType.DEPLOYMENT, DocumentTools.INSTANCE.getDocumentBuilder().newDocument());
    assertFalse(entities.isEmpty());
    assertEquals(1, entities.size());
    e = entities.get(0);
    assertEquals(EntityTypes.POLICY_TYPE, e.getType());
    assertEquals(e.getId(), "policyID");
}