RequiredElementSecurityEvent requiredElementSecurityEvent = new RequiredElementSecurityEvent();
requiredElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
try {
policyEnforcer.doFinal();
Assert.fail("Exception expected");
} catch (WSSPolicyException e) {
Assert.assertEquals(e.getMessage(), "Element /{http://example.org}a must be present");
}
}