/**
   * Creates a SAMLV2 {@code AssertionType} with the specified values.
   *
   * @param id a {@code String} representing the assertion ID.
   * @param issuerID a {@code NameIDType} that identifies the assertion issuer.
   * @param issueInstant the assertion time of creation.
   * @param conditions the {@code ConditionsType} that specify the conditions under which the
   *     assertion is to be considered valid
   * @param subject the {@code SubjectType} that identifies the authenticated principal.
   * @param statements a list of statements associated with the authenticated principal.
   * @return
   */
  public static AssertionType createAssertion(
      String id,
      NameIDType issuerID,
      XMLGregorianCalendar issueInstant,
      ConditionsType conditions,
      SubjectType subject,
      List<StatementAbstractType> statements) {
    AssertionType assertion = new AssertionType(id, issueInstant);
    assertion.setIssuer(issuerID);
    if (conditions != null) assertion.setConditions(conditions);
    if (subject != null) assertion.setSubject(subject);

    if (statements != null) {
      for (StatementAbstractType statement : statements) {
        assertion.addStatement(statement);
      }
    }
    return assertion;
  }