@Test
  public void generateHeaderStrategyForNonThirdPartyTest() throws Exception {
    SignatureCredential signatureCredential =
        new SignatureCredential("testusername", "testpassword", "testsignature");
    SignatureSOAPHeaderAuthStrategy signatureSOAPHeaderAuthStrategy =
        new SignatureSOAPHeaderAuthStrategy();
    String payload = signatureSOAPHeaderAuthStrategy.generateHeaderStrategy(signatureCredential);

    Document dom = loadXMLFromString(payload);
    Element docEle = dom.getDocumentElement();
    NodeList credential = docEle.getElementsByTagName("ebl:Credentials");
    NodeList user = ((Element) credential.item(0)).getElementsByTagName("ebl:Username");
    NodeList psw = ((Element) credential.item(0)).getElementsByTagName("ebl:Password");
    NodeList sign = ((Element) credential.item(0)).getElementsByTagName("ebl:Signature");
    NodeList subject = ((Element) credential.item(0)).getElementsByTagName("ebl:Subject");

    String username = user.item(0).getTextContent();
    String password = psw.item(0).getTextContent();
    String signature = sign.item(0).getTextContent();
    Object sub = subject.item(0);

    Assert.assertEquals("testusername", username);
    Assert.assertEquals("testpassword", password);
    Assert.assertEquals("testsignature", signature);
    Assert.assertNull(sub);
  }
  public String getPayLoad() {

    // This method appends SOAP Headers to payload
    // if the credentials mandate soap headers
    if (payLoad == null) {
      payLoad = apiCallHandler.getPayLoad();
      String header = null;
      if (credential instanceof SignatureCredential) {
        SignatureCredential sigCredential = (SignatureCredential) credential;
        SignatureSOAPHeaderAuthStrategy signatureSoapHeaderAuthStrategy =
            new SignatureSOAPHeaderAuthStrategy();
        signatureSoapHeaderAuthStrategy.setThirdPartyAuthorization(
            sigCredential.getThirdPartyAuthorization());
        header = signatureSoapHeaderAuthStrategy.generateHeaderStrategy(sigCredential);
      } else if (credential instanceof CertificateCredential) {
        CertificateCredential certCredential = (CertificateCredential) credential;
        CertificateSOAPHeaderAuthStrategy certificateSoapHeaderAuthStrategy =
            new CertificateSOAPHeaderAuthStrategy();
        certificateSoapHeaderAuthStrategy.setThirdPartyAuthorization(
            certCredential.getThirdPartyAuthorization());
        header = certificateSoapHeaderAuthStrategy.generateHeaderStrategy(certCredential);
      }
      payLoad = getPayLoadUsingSOAPHeader(payLoad, getNamespaces(), header);
    }
    return payLoad;
  }
 @Test
 public void setGetThirdPartyAuthorization() {
   SignatureSOAPHeaderAuthStrategy signatureSOAPHeaderAuthStrategy =
       new SignatureSOAPHeaderAuthStrategy();
   SubjectAuthorization subjectAuthorization = new SubjectAuthorization("testsubject");
   signatureSOAPHeaderAuthStrategy.setThirdPartyAuthorization(subjectAuthorization);
   Assert.assertNotNull(signatureSOAPHeaderAuthStrategy.getThirdPartyAuthorization());
 }
 @Test
 public void generateHeaderStrategyForTokenTest() throws Exception {
   SignatureCredential signatureCredential =
       new SignatureCredential("testusername", "testpassword", "testsignature");
   SignatureSOAPHeaderAuthStrategy signatureSOAPHeaderAuthStrategy =
       new SignatureSOAPHeaderAuthStrategy();
   TokenAuthorization tokenAuthorization = new TokenAuthorization("accessToken", "tokenSecret");
   signatureSOAPHeaderAuthStrategy.setThirdPartyAuthorization(tokenAuthorization);
   signatureCredential.setThirdPartyAuthorization(tokenAuthorization);
   String payload = signatureSOAPHeaderAuthStrategy.generateHeaderStrategy(signatureCredential);
   Assert.assertEquals("<ns:RequesterCredentials/>", payload);
 }