@Test void testPrepareHardcodedResponseAssertion() throws DocumentParseException { Element hardcodedAssertionElement = createHardcodedAssertionElement(document, "assertion body"); document.appendChild(hardcodedAssertionElement); policyBuilderContext = new PolicyBuilderContext("path.xml", document, bundle, new IdGenerator()); policyBuilderContext.withPolicy(policy); hardcodedResponseAssertionBuilder.buildAssertionElement(hardcodedAssertionElement, policyBuilderContext); Element b64BodyElement = getSingleElement(hardcodedAssertionElement, BASE_64_RESPONSE_BODY); String b64 = b64BodyElement.getAttribute(PolicyEntityBuilder.STRING_VALUE); assertEquals(Base64.getEncoder().encodeToString("assertion body".getBytes(StandardCharsets.UTF_8)), b64); }
@Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { PolicyAssertionBuilder.prepareBase64Element(policyBuilderContext.getPolicyDocument(), assertionElement, RESPONSE_BODY, BASE_64_RESPONSE_BODY); }
HardcodedResponseAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { PolicyAssertionBuilder.prepareBase64Element(policyBuilderContext.getPolicyDocument(), assertionElement, RESPONSE_BODY, BASE_64_RESPONSE_BODY); } }
HardcodedResponseAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { PolicyAssertionBuilder.prepareBase64Element(policyBuilderContext.getPolicyDocument(), assertionElement, RESPONSE_BODY, BASE_64_RESPONSE_BODY); }  }
HardcodedResponseAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { PolicyAssertionBuilder.prepareBase64Element(policyBuilderContext.getPolicyDocument(), assertionElement, RESPONSE_BODY, BASE_64_RESPONSE_BODY); }  @Override void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext); @Override String getAssertionTagName(); }
HardcodedResponseAssertionBuilder implements PolicyAssertionBuilder { @Override public void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext) throws DocumentParseException { PolicyAssertionBuilder.prepareBase64Element(policyBuilderContext.getPolicyDocument(), assertionElement, RESPONSE_BODY, BASE_64_RESPONSE_BODY); }  @Override void buildAssertionElement(Element assertionElement, PolicyBuilderContext policyBuilderContext); @Override String getAssertionTagName();  }