public void testWrongVersion() {
   target = buildXMLObject(targetQName);
   setupRequiredData();
   assertValidationPass("SAML1.0 is OK");
   Assertion assertion = (Assertion) target;
   assertion.setVersion(SAMLVersion.VERSION_20);
   assertValidationFail("SAML2.0 is not OK");
 }
 public void testMissingIssuer() {
   Assertion assertion = (Assertion) target;
   assertion.setIssuer("");
   assertValidationFail("Issuer was empty, should raise a Validation Exception");
   assertion.setIssuer(null);
   assertValidationFail("Issuer was null, should raise a Validation Exception");
   assertion.setIssuer("   ");
   assertValidationFail("Issuer was whitespace, should raise a Validation Exception");
 }
  /** Common setup method (populateRequiredData & the first test */
  private void setupRequiredData() {

    Assertion assertion = (Assertion) target;
    assertion.setIssuer("Issuer");
    assertion.setID("ident");
    assertion.setIssueInstant(new DateTime());
    QName name =
        new QName(
            SAMLConstants.SAML1_NS,
            AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML1_PREFIX);
    assertion.getStatements().add((AttributeStatement) buildXMLObject(name));
  }
  protected void validateDoNotCache(Assertion assertion) throws ValidationException {

    if (assertion.getMinorVersion() == 0) {
      Conditions conditions = assertion.getConditions();
      if (conditions != null) {
        for (Condition condition : conditions.getConditions()) {
          if (condition instanceof DoNotCacheCondition) {
            throw new ValidationException("DoNotCacheCondition not valid in SAML1.0");
          }
        }
      }
    }
  }
 public void testMissingStatement() {
   Assertion assertion = (Assertion) target;
   assertion.getStatements().clear();
   assertValidationFail("No statements, should raise a Validation Exception");
 }
 public void testMissingIssueInstant() {
   Assertion assertion = (Assertion) target;
   assertion.setIssueInstant(null);
   assertValidationFail("IssueInstant was empty, should raise a Validation Exception");
 }