@Test
void testPrepareEncapsulatedAssertionWithWrongGuidAndGoid() throws DocumentParseException {

    String policyPath = "my/policy/path.xml";
    Encass encass = new Encass();
    encass.setGuid("123");
    encass.setName(TEST_ENCASS);
    encass.setPolicy(policyPath);
    Set<Annotation> annotations = new HashSet<>();
    //annotations.add(new Annotation(AnnotationType.SHARED));
    Annotation annotation = new Annotation(AnnotationType.BUNDLE_HINTS);
    annotation.setGuid("");
    annotation.setId("");
    annotations.add(annotation);
    encass.setAnnotations(annotations);
    bundle.getEncasses().put(TEST_ENCASS, encass);
    //empty guid and goid
    AnnotatedEntity annotatedEntity = encass.getAnnotatedEntity();
    AnnotatedBundle annotatedBundle = new AnnotatedBundle(bundle, annotatedEntity, projectInfo);
    annotatedBundle.putAllEncasses(org.testcontainers.shaded.com.google.common.collect.ImmutableMap.of(TEST_ENCASS, encass));
    annotatedBundle.getPolicies().put(policyPath, policy);
    Element encapsulatedAssertionElement = createEncapsulatedAssertionElement(document);
    document.appendChild(encapsulatedAssertionElement);
    policyBuilderContext = new PolicyBuilderContext("path.xml", document, bundle, new IdGenerator());
    policyBuilderContext.withPolicy(policy);
    policyBuilderContext.withAnnotatedBundle(annotatedBundle);
    encapsulatedAssertionBuilder.buildAssertionElement(encapsulatedAssertionElement, policyBuilderContext);
    Element nameElement = getSingleElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_NAME);
    String name = annotatedBundle.applyUniqueName(TEST_ENCASS, DEPLOYMENT, false);
    assertEquals(name, nameElement.getAttribute(PolicyEntityBuilder.STRING_VALUE));
    Element guidElement = getSingleElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID);
    assertEquals(encass.getGuid(), guidElement.getAttribute(PolicyEntityBuilder.STRING_VALUE));
    //wrong guid and goid
    annotatedEntity = encass.getAnnotatedEntity();
    annotations = new HashSet<>();
    annotations.add(new Annotation(AnnotationType.SHARED));
    annotation = new Annotation(AnnotationType.BUNDLE_HINTS);
    annotation.setGuid("wrongGuid");
    annotation.setId("wrongId");
    annotations.add(annotation);
    encass.setAnnotations(annotations);
    encass.setAnnotatedEntity(null);
    annotatedBundle = new AnnotatedBundle(bundle, annotatedEntity, projectInfo);
    annotatedBundle.putAllEncasses(org.testcontainers.shaded.com.google.common.collect.ImmutableMap.of(TEST_ENCASS, encass));
    annotatedBundle.getPolicies().put(policyPath, policy);
    encapsulatedAssertionElement = createEncapsulatedAssertionElement(document);
    policyBuilderContext = new PolicyBuilderContext("path.xml", document, bundle, new IdGenerator());
    policyBuilderContext.withPolicy(policy);
    policyBuilderContext.withAnnotatedBundle(annotatedBundle);
    encapsulatedAssertionBuilder.buildAssertionElement(encapsulatedAssertionElement, policyBuilderContext);
    guidElement = getSingleElement(encapsulatedAssertionElement, ENCAPSULATED_ASSERTION_CONFIG_GUID);
    assertEquals(encass.getGuid(), guidElement.getAttribute(PolicyEntityBuilder.STRING_VALUE));
}