/** {@inheritDoc} */
  @Test
  public void testSingleElementOptionalAttributesUnmarshall() {
    AuthnRequest req = (AuthnRequest) unmarshallElement(singleElementOptionalAttributesFile);

    Assert.assertEquals(
        req.isForceAuthnXSBoolean(),
        expectedForceAuthn,
        "Unmarshalled ForceAuthn was not the expected value");
    Assert.assertEquals(
        req.isPassiveXSBoolean(),
        expectedIsPassive,
        "Unmarshalled IsPassive was not the expected value");
    Assert.assertEquals(
        req.getProtocolBinding(),
        expectedProtocolBinding,
        "Unmarshalled ProtocolBinding was not the expected value");
    Assert.assertEquals(
        req.getAssertionConsumerServiceIndex(),
        expectedAssertionConsumerServiceIndex,
        "Unmarshalled AssertionConsumerServiceIndex was not the expected value");
    Assert.assertEquals(
        req.getAssertionConsumerServiceURL(),
        expectedAssertionConsumerServiceURL,
        "Unmarshalled AssertionConsumerServiceURL was not the expected value");
    Assert.assertEquals(
        req.getAttributeConsumingServiceIndex(),
        expectedAttributeConsumingServiceIndex,
        "Unmarshalled AttributeConsumingServiceIndex was not the expected value");
    Assert.assertEquals(
        req.getProviderName(),
        expectedProviderName,
        "Unmarshalled ProviderName was not the expected value");

    super.helperTestSingleElementOptionalAttributesUnmarshall(req);
  }
  @BeforeMethod
  protected void setUp() throws Exception {
    super.setUp();

    expectedForceAuthn = new XSBooleanValue(Boolean.TRUE, false);
    expectedIsPassive = new XSBooleanValue(Boolean.TRUE, false);
    expectedProtocolBinding = "urn:string:protocol-binding";
    expectedAssertionConsumerServiceIndex = new Integer(3);
    expectedAssertionConsumerServiceURL = "http://sp.example.org/acs";
    expectedAttributeConsumingServiceIndex = new Integer(2);
    expectedProviderName = "Example Org";
  }
  /** {@inheritDoc} */
  @Test
  public void testChildElementsUnmarshall() {
    AuthnRequest req = (AuthnRequest) unmarshallElement(childElementsFile);

    Assert.assertNotNull(req.getSubject(), "Subject was null");
    Assert.assertNotNull(req.getNameIDPolicy(), "NameIDPolicy was null");
    Assert.assertNotNull(req.getConditions(), "Conditions was null");
    Assert.assertNotNull(req.getRequestedAuthnContext(), "RequestedAuthnContext was null");
    Assert.assertNotNull(req.getScoping(), "Scoping was null");

    super.helperTestChildElementsUnmarshall(req);
  }
  /** {@inheritDoc} */
  @Test
  public void testSingleElementOptionalAttributesMarshall() {
    QName qname =
        new QName(
            SAMLConstants.SAML20P_NS,
            AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    AuthnRequest req = (AuthnRequest) buildXMLObject(qname);

    super.populateRequiredAttributes(req);
    super.populateOptionalAttributes(req);

    req.setForceAuthn(expectedForceAuthn);
    req.setIsPassive(expectedIsPassive);
    req.setProtocolBinding(expectedProtocolBinding);
    req.setAssertionConsumerServiceIndex(expectedAssertionConsumerServiceIndex);
    req.setAssertionConsumerServiceURL(expectedAssertionConsumerServiceURL);
    req.setAttributeConsumingServiceIndex(expectedAttributeConsumingServiceIndex);
    req.setProviderName(expectedProviderName);

    assertXMLEquals(expectedOptionalAttributesDOM, req);
  }
  /** {@inheritDoc} */
  @Test
  public void testSingleElementMarshall() {
    QName qname =
        new QName(
            SAMLConstants.SAML20P_NS,
            AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    AuthnRequest req = (AuthnRequest) buildXMLObject(qname);

    super.populateRequiredAttributes(req);

    assertXMLEquals(expectedDOM, req);
  }
  /** {@inheritDoc} */
  @Test
  public void testChildElementsMarshall() {
    QName qname =
        new QName(
            SAMLConstants.SAML20P_NS,
            AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    AuthnRequest req = (AuthnRequest) buildXMLObject(qname);

    super.populateChildElements(req);

    QName subjectQName =
        new QName(
            SAMLConstants.SAML20_NS,
            Subject.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20_PREFIX);
    req.setSubject((Subject) buildXMLObject(subjectQName));

    QName nameIDPolicyQName =
        new QName(
            SAMLConstants.SAML20P_NS,
            NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    req.setNameIDPolicy((NameIDPolicy) buildXMLObject(nameIDPolicyQName));

    QName conditionsQName =
        new QName(
            SAMLConstants.SAML20_NS,
            Conditions.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20_PREFIX);
    req.setConditions((Conditions) buildXMLObject(conditionsQName));

    QName requestedAuthnContextQName =
        new QName(
            SAMLConstants.SAML20P_NS,
            RequestedAuthnContext.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    req.setRequestedAuthnContext(
        (RequestedAuthnContext) buildXMLObject(requestedAuthnContextQName));

    QName scopingQName =
        new QName(
            SAMLConstants.SAML20P_NS,
            Scoping.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
    req.setScoping((Scoping) buildXMLObject(scopingQName));

    assertXMLEquals(expectedChildElementsDOM, req);
  }
  /** {@inheritDoc} */
  @Test
  public void testSingleElementUnmarshall() {
    AuthnRequest req = (AuthnRequest) unmarshallElement(singleElementFile);

    Assert.assertNotNull(req, "AuthnRequest was null");
    Assert.assertEquals(
        req.isForceAuthn(), Boolean.FALSE, "ForceAuthn (empty) was not default value");
    Assert.assertEquals(req.isPassive(), Boolean.FALSE, "IsPassive (empty) was not default value");
    Assert.assertNull(req.getProtocolBinding(), "ProtocolBinding was not null");
    Assert.assertNull(
        req.getAssertionConsumerServiceIndex(), "AssertionConsumerServiceIndex was not null");
    Assert.assertNull(
        req.getAssertionConsumerServiceURL(), "AssertionConsumerServiceURL was not null");
    Assert.assertNull(
        req.getAttributeConsumingServiceIndex(), "AttributeConsumingServiceIndex was not null");
    Assert.assertNull(req.getProviderName(), "ProviderName was not null");

    super.helperTestSingleElementUnmarshall(req);
  }