@Test
public void createParseResponse() throws CertificateException, IOException, UnrecoverableKeyException,
  KeyStoreException, NoSuchAlgorithmException, NoSuchProviderException, KeyException, XMLParserException,
  UnmarshallingException, EncryptionException, MarshallingException, SignatureException,
  TransformerFactoryConfigurationError, TransformerException, ErrorCodeException, InitializationException,
  ComponentInitializationException
{

  BirthNameAttribute birthName = new BirthNameAttribute("Meyer");
  CurrentAddressAttribute currentAddress = new CurrentAddressAttribute("Am Fallturm", "33", "Bremen",
                                                                       "28207", "100", "bla", "bla", "bla",
                                                                       "bla");
  DateOfBirthAttribute dao = new DateOfBirthAttribute("1982-02-11");
  FamilyNameAttribute familyName = new FamilyNameAttribute("Muller", "Müller");
  GenderAttribute gender = new GenderAttribute(GenderType.MALE);
  GivenNameAttribute givenName = new GivenNameAttribute("Bjorn", "Bjørn");
  PersonIdentifierAttribute pi = new PersonIdentifierAttribute("test12321");
  PlaceOfBirthAttribute pob = new PlaceOfBirthAttribute("Saint-Étienne, France");
  ArrayList<EidasAttribute> att = new ArrayList<>();
  att.add(birthName);
  att.add(currentAddress);
  att.add(dao);
  att.add(familyName);
  att.add(gender);
  att.add(givenName);
  att.add(pi);
  att.add(pob);
  String destination = "test destination";
  String recipient = "test_recipient";
  EidasNameId nameid = new EidasPersistentNameId("eidasnameidTest");
  String issuer = "test issuer";
  String inResponseTo = "test inResponseTo";
  EidasLoA loa = EidasLoA.SUBSTANTIAL;
  X509Certificate[] cert = {Utils.readCert(TestEidasSaml.class.getResourceAsStream("/EidasSignerTest_x509.cer"))};
  X509KeyPair[] keypair = {Utils.readPKCS12(TestEidasSaml.class.getResourceAsStream(TEST_P12),
                                            "123456".toCharArray())};
  PrivateKey pk = keypair[0].getKey();
  EidasEncrypter encrypter = new EidasEncrypter(true, cert[0]);
  EidasSigner signer = new EidasSigner(true, pk, cert[0]);
  byte[] response = EidasSaml.createResponse(att,
                                             destination,
                                             recipient,
                                             nameid,
                                             issuer,
                                             loa,
                                             inResponseTo,
                                             encrypter,
                                             signer);
  System.out.println("-->>Response-->>" + new String(response));
  EidasResponse result = EidasResponse.parse(new ByteArrayInputStream(response), keypair, cert);
  assertEquals(result.getDestination(), destination);
  assertEquals(result.getNameId().getValue(), nameid.getValue());
  assertEquals(result.getIssuer(), issuer);
  assertEquals(result.getInResponseTo(), inResponseTo);
  for ( int i = 0 ; i < att.size() ; i++ )
  {
    assertEquals(result.getAttributes().get(i).getLatinScript().replaceAll("\\s+", ""),
                 att.get(i).getLatinScript().replaceAll("\\s+", ""));
  }
}