@Test
public void testGenerateLegalAddressAttribute() throws IOException
{

  String locatorDesignator = "locatorDesignator";
  String thoroughfare = "thoroughfare";
  String postName = "postName";
  String postCode = "postCode";
  String pOBOX = "pOBOX";
  String locatorName = "locatorName";
  String cvaddressArea = "cvaddressArea";
  String adminunitFirstline = "adminunitFirstline";
  String adminunitSecondline = "adminunitSecondline";
  LegalAddressAttribute attribute = new LegalAddressAttribute(locatorDesignator, thoroughfare, postName,
                                                              postCode, pOBOX, locatorName, cvaddressArea,
                                                              adminunitFirstline, adminunitSecondline);
  TemplateLoader.init();
  String xml = attribute.generate();
  Assertions.assertTrue(StringUtils.isNotEmpty(xml));
  String substringBetween = StringUtils.substringBetween(xml,
                                                         "<saml2:AttributeValue xsi:type=\"eidas:LegalPersonAddressType\">",
                                                         "</saml2:AttributeValue>");
  Assertions.assertTrue(StringUtils.isNotEmpty(substringBetween));
  String base64Decoded = Utils.fromBase64(substringBetween);
  Assertions.assertTrue(StringUtils.isNotEmpty(base64Decoded));
  Assertions.assertTrue(base64Decoded.contains("locatorDesignator"));
  Assertions.assertTrue(base64Decoded.contains("thoroughfare"));
  Assertions.assertTrue(base64Decoded.contains("postName"));
  Assertions.assertTrue(base64Decoded.contains("postCode"));
  Assertions.assertTrue(base64Decoded.contains("locatorName"));
  Assertions.assertTrue(base64Decoded.contains("cvaddressArea"));
  Assertions.assertTrue(base64Decoded.contains("adminunitFirstline"));
  Assertions.assertTrue(base64Decoded.contains("adminunitSecondline"));
}