You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2019/01/03 10:57:45 UTC
svn commit: r1850225 [5/6] - in /santuario/xml-security-java/trunk: etc/
src/test/java/javax/xml/crypto/test/
src/test/java/javax/xml/crypto/test/dsig/
src/test/java/javax/xml/crypto/test/dsig/dom/
src/test/java/javax/xml/crypto/test/dsig/keyinfo/ src/...
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java Thu Jan 3 10:57:43 2019
@@ -45,17 +45,18 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import static org.junit.Assert.assertEquals;
+
/**
* A test to make sure that the various Symmetric Encryption algorithms are working
*/
-public class SymmetricEncryptionCreationTest extends Assert {
+public class SymmetricEncryptionCreationTest {
private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
@@ -135,24 +136,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -196,24 +197,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -257,24 +258,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -318,24 +319,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -379,24 +380,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -440,24 +441,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -500,24 +501,24 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
// Check the CreditCard decrypted ok
nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -563,17 +564,17 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
@@ -625,17 +626,17 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
@@ -687,17 +688,17 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
@@ -749,17 +750,17 @@ public class SymmetricEncryptionCreation
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// Check the CreditCard encrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
nodeList = document.getElementsByTagNameNS(
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Decrypt using DOM API
Document doc = decryptUsingDOM(algorithm, key, null, document);
@@ -791,4 +792,4 @@ public class SymmetricEncryptionCreation
return cipher.doFinal(document, ee);
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java Thu Jan 3 10:57:43 2019
@@ -53,17 +53,20 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.StAX2DOM;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* A test to make sure that the various Symmetric Encryption algorithms are working
*/
-public class SymmetricEncryptionVerificationTest extends Assert {
+public class SymmetricEncryptionVerificationTest {
private static boolean bcInstalled;
private XMLInputFactory xmlInputFactory;
@@ -126,7 +129,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -152,7 +155,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -178,7 +181,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -204,7 +207,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -230,7 +233,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -256,7 +259,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -282,7 +285,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -308,7 +311,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -334,7 +337,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -360,7 +363,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -386,7 +389,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -412,7 +415,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -437,7 +440,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -463,7 +466,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -491,7 +494,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -517,7 +520,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -545,7 +548,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -571,7 +574,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -599,7 +602,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -625,7 +628,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
@Test
@@ -653,7 +656,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard encrypted ok
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
// XMLUtils.outputDOM(document, System.out);
@@ -679,7 +682,7 @@ public class SymmetricEncryptionVerifica
// Check the CreditCard decrypted ok
nodeList = document.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
}
private void encryptUsingDOM(
@@ -750,7 +753,7 @@ public class SymmetricEncryptionVerifica
String expression = "//*[local-name()='" + localName + "']";
Element elementToEncrypt =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(elementToEncrypt);
+ assertNotNull(elementToEncrypt);
document = cipher.doFinal(document, elementToEncrypt, content);
}
@@ -759,7 +762,7 @@ public class SymmetricEncryptionVerifica
XMLSecurityConstants.TAG_xenc_EncryptedData.getNamespaceURI(),
XMLSecurityConstants.TAG_xenc_EncryptedData.getLocalPart()
);
- Assert.assertTrue(nodeList.getLength() > 0);
+ assertTrue(nodeList.getLength() > 0);
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/XMLEncryption11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/XMLEncryption11Test.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/XMLEncryption11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/encryption/XMLEncryption11Test.java Thu Jan 3 10:57:43 2019
@@ -64,16 +64,21 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.Before;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
/**
*/
-public class XMLEncryption11Test extends Assert {
+public class XMLEncryption11Test {
private String cardNumber;
private int nodeCount;
@@ -408,12 +413,12 @@ public class XMLEncryption11Test extends
// Perform decryption
try {
decryptElementStAX(ed, rsaKey);
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof IOException);
- Assert.assertTrue(e.getCause().getCause() instanceof BadPaddingException);
+ assertTrue(e.getCause() instanceof IOException);
+ assertTrue(e.getCause().getCause() instanceof BadPaddingException);
String cause = e.getCause().getCause().getMessage();
- Assert.assertTrue("mac check in GCM failed".equals(cause) || "Tag mismatch!".equals(cause));
+ assertTrue("mac check in GCM failed".equals(cause) || "Tag mismatch!".equals(cause));
}
}
@@ -537,28 +542,28 @@ public class XMLEncryption11Test extends
}
NodeList nodeList = document.getElementsByTagNameNS("urn:example:po", "PaymentInfo");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
NodeList encryptionMethodElements = document.getElementsByTagNameNS(XMLSecurityConstants.NS_XMLENC, "EncryptionMethod");
- Assert.assertEquals(2, encryptionMethodElements.getLength());
- Assert.assertEquals(encryptionMethodAlgo, ((Element) encryptionMethodElements.item(0)).getAttribute("Algorithm"));
- Assert.assertEquals(encryptedKeyAlgo, ((Element) encryptionMethodElements.item(1)).getAttribute("Algorithm"));
+ assertEquals(2, encryptionMethodElements.getLength());
+ assertEquals(encryptionMethodAlgo, ((Element) encryptionMethodElements.item(0)).getAttribute("Algorithm"));
+ assertEquals(encryptedKeyAlgo, ((Element) encryptionMethodElements.item(1)).getAttribute("Algorithm"));
if (digestMethodAlgo != null) {
NodeList digestMethodElements = document.getElementsByTagNameNS(XMLSecurityConstants.NS_DSIG, "DigestMethod");
- Assert.assertEquals(1, digestMethodElements.getLength());
- Assert.assertEquals(digestMethodAlgo, ((Element) digestMethodElements.item(0)).getAttribute("Algorithm"));
+ assertEquals(1, digestMethodElements.getLength());
+ assertEquals(digestMethodAlgo, ((Element) digestMethodElements.item(0)).getAttribute("Algorithm"));
}
if (mgfAlgo != null) {
NodeList mfgElements = document.getElementsByTagNameNS(XMLSecurityConstants.NS_XMLENC11, "MGF");
- Assert.assertEquals(1, mfgElements.getLength());
- Assert.assertEquals(mgfAlgo, ((Element) mfgElements.item(0)).getAttribute("Algorithm"));
+ assertEquals(1, mfgElements.getLength());
+ assertEquals(mgfAlgo, ((Element) mfgElements.item(0)).getAttribute("Algorithm"));
}
if (oaepParams != null) {
NodeList oaepParamsElements = document.getElementsByTagNameNS(XMLSecurityConstants.NS_XMLENC, "OAEPparams");
- Assert.assertEquals(1, oaepParamsElements.getLength());
+ assertEquals(1, oaepParamsElements.getLength());
String content = XMLUtils.getFullTextChildrenFromNode(oaepParamsElements.item(0));
- Assert.assertArrayEquals(oaepParams, XMLUtils.decode(content));
+ assertArrayEquals(oaepParams, XMLUtils.decode(content));
}
return document;
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureCreationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureCreationTest.java Thu Jan 3 10:57:43 2019
@@ -37,14 +37,18 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.utils.resolver.ResourceResolverContext;
import org.apache.xml.security.utils.resolver.ResourceResolverException;
import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
-import org.junit.Assert;
import org.junit.Before;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
/**
*/
-public class AbstractSignatureCreationTest extends Assert {
+public class AbstractSignatureCreationTest {
protected static String BASEDIR;
@@ -103,7 +107,7 @@ public class AbstractSignatureCreationTe
String expression = "//dsig:Signature[1]";
Element sigElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(sigElement);
+ assertNotNull(sigElement);
for (SecurePart securePart : secureParts) {
if (securePart.getName() == null) {
@@ -112,7 +116,7 @@ public class AbstractSignatureCreationTe
expression = "//*[local-name()='" + securePart.getName().getLocalPart() + "']";
Element signedElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(signedElement);
+ assertNotNull(signedElement);
signedElement.setIdAttributeNS(null, idAttributeNS, true);
}
@@ -122,10 +126,10 @@ public class AbstractSignatureCreationTe
}
if (keyInfoRequired) {
KeyInfo ki = signature.getKeyInfo();
- Assert.assertNotNull(ki);
+ assertNotNull(ki);
}
- Assert.assertTrue(signature.checkSignatureValue(cert));
+ assertTrue(signature.checkSignatureValue(cert));
}
/**
@@ -141,18 +145,18 @@ public class AbstractSignatureCreationTe
String expression = "//dsig:Signature[1]";
Element sigElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(sigElement);
+ assertNotNull(sigElement);
for (SecurePart securePart : secureParts) {
expression = "//*[local-name()='" + securePart.getName().getLocalPart() + "']";
Element signedElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(signedElement);
+ assertNotNull(signedElement);
signedElement.setIdAttributeNS(null, "Id", true);
}
XMLSignature signature = new XMLSignature(sigElement, "");
- Assert.assertTrue(signature.checkSignatureValue(key));
+ assertTrue(signature.checkSignatureValue(key));
}
protected void verifyUsingDOMWihtoutId(
@@ -165,22 +169,22 @@ public class AbstractSignatureCreationTe
String expression = "//dsig:Signature[1]";
Element sigElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(sigElement);
- Assert.assertEquals("", sigElement.getAttribute("Id"));
+ assertNotNull(sigElement);
+ assertEquals("", sigElement.getAttribute("Id"));
assertEquals("Without Id there can only be one secure part", 1, secureParts.size());
expression = "//*[local-name()='" + secureParts.get(0).getName().getLocalPart() + "']";
Element signedElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(signedElement);
- Assert.assertEquals("", signedElement.getAttribute("Id"));
+ assertNotNull(signedElement);
+ assertEquals("", signedElement.getAttribute("Id"));
XMLSignature signature = new XMLSignature(sigElement, "");
// We need a special resolver for the empty URI
signature.addResourceResolver(new EmptyURIResourceResolverSpi(signedElement));
- Assert.assertTrue(signature.checkSignatureValue(key));
+ assertTrue(signature.checkSignatureValue(key));
}
protected void verifyUsingDOMWihtoutIdAndDefaultTransform (
@@ -193,8 +197,8 @@ public class AbstractSignatureCreationTe
String expression = "//dsig:Signature[1]";
Element sigElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(sigElement);
- Assert.assertEquals("", sigElement.getAttribute("Id"));
+ assertNotNull(sigElement);
+ assertEquals("", sigElement.getAttribute("Id"));
assertEquals("Without Id there can only be one secure part", 1, secureParts.size());
//assertNull(secureParts.get(0).getName());
@@ -206,7 +210,7 @@ public class AbstractSignatureCreationTe
// We need a special resolver for the empty URI
signature.addResourceResolver(new EmptyURIResourceResolverSpi(signedElement));
- Assert.assertTrue(signature.checkSignatureValue(key));
+ assertTrue(signature.checkSignatureValue(key));
}
private XPath getxPath() {
@@ -236,4 +240,4 @@ public class AbstractSignatureCreationTe
return context.uriToResolve.isEmpty();
}
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureVerificationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureVerificationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureVerificationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/AbstractSignatureVerificationTest.java Thu Jan 3 10:57:43 2019
@@ -32,7 +32,6 @@ import org.apache.xml.security.test.dom.
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.resolver.ResourceResolverSpi;
-import org.junit.Assert;
import org.junit.Before;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -49,9 +48,15 @@ import java.security.cert.X509Certificat
import java.util.List;
import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
/**
*/
-public class AbstractSignatureVerificationTest extends Assert {
+public class AbstractSignatureVerificationTest {
protected static String BASEDIR;
@@ -224,7 +229,7 @@ public class AbstractSignatureVerificati
(NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET);
for (int i = 0; i < elementsToSign.getLength(); i++) {
Element elementToSign = (Element)elementsToSign.item(i);
- Assert.assertNotNull(elementToSign);
+ assertNotNull(elementToSign);
String id = UUID.randomUUID().toString();
elementToSign.setAttributeNS(null, "Id", id);
elementToSign.setIdAttributeNS(null, "Id", true);
@@ -256,7 +261,7 @@ public class AbstractSignatureVerificati
String expression = "//ds:Signature[1]";
Element sigElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(sigElement);
+ assertNotNull(sigElement);
return sig;
}
@@ -434,4 +439,4 @@ public class AbstractSignatureVerificati
this.binary = binary;
}
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java Thu Jan 3 10:57:43 2019
@@ -66,17 +66,22 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.implementations.ResolverDirectHTTP;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
/**
* This test is to ensure interoperability with the examples provided by Merlin Huges
* from Baltimore using KeyTools XML. These test vectors are located in the directory
* <CODE>data/ie/baltimore/merlin-examples/</CODE>.
*/
-public class BaltimoreTest extends Assert {
+public class BaltimoreTest {
// Define the Keys
private static final String DSA_Y_15 =
@@ -191,8 +196,8 @@ public class BaltimoreTest extends Asser
StAX2DOM.readDoc(securityStreamReader);
fail("Failure expected on a short HMAC length");
} catch (XMLStreamException ex) {
- Assert.assertTrue(ex.getCause() instanceof XMLSecurityException);
- Assert.assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
+ assertTrue(ex.getCause() instanceof XMLSecurityException);
+ assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
}
}
@@ -515,8 +520,8 @@ public class BaltimoreTest extends Asser
StAX2DOM.readDoc(securityStreamReader);
fail("Failure expected on a short HMAC length");
} catch (XMLStreamException ex) {
- Assert.assertTrue(ex.getCause() instanceof XMLSecurityException);
- Assert.assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
+ assertTrue(ex.getCause() instanceof XMLSecurityException);
+ assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
}
}
@@ -1633,4 +1638,4 @@ public class BaltimoreTest extends Asser
}
}
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java Thu Jan 3 10:57:43 2019
@@ -60,17 +60,22 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.TestUtils;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
/**
* This test is to ensure interoperability with the examples provided by the IAIK
* XML Signature implementation. Thanks to Gregor Karlinger who provided these
* test vectors. They are located in the directory <CODE>data/at/iaik/ixsil/</CODE>.
*/
-public class IAIKTest extends Assert {
+public class IAIKTest {
// Define the Keys
private static final String DSA_Y =
@@ -170,8 +175,8 @@ public class IAIKTest extends Assert {
StAX2DOM.readDoc(securityStreamReader);
fail("Failure expected on a short HMAC length");
} catch (XMLStreamException ex) {
- Assert.assertTrue(ex.getCause() instanceof XMLSecurityException);
- Assert.assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
+ assertTrue(ex.getCause() instanceof XMLSecurityException);
+ assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
}
}
@@ -407,4 +412,4 @@ public class IAIKTest extends Assert {
}
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java Thu Jan 3 10:57:43 2019
@@ -30,7 +30,6 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.implementations.ResolverDirectHTTP;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;
@@ -51,11 +50,16 @@ import java.net.InetSocketAddress;
import java.net.Proxy;
import java.nio.charset.StandardCharsets;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
/**
* This is a testcase to validate all "phaos-xmldsig-three"
* testcases from Phaos
*/
-public class PhaosTest extends Assert {
+public class PhaosTest {
private XMLInputFactory xmlInputFactory;
private TransformerFactory transformerFactory = TransformerFactory.newInstance();
@@ -384,8 +388,8 @@ public class PhaosTest extends Assert {
StAX2DOM.readDoc(securityStreamReader);
fail("Failure expected on a bad digest");
} catch (XMLStreamException ex) {
- Assert.assertTrue(ex.getCause() instanceof XMLSecurityException);
- Assert.assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
+ assertTrue(ex.getCause() instanceof XMLSecurityException);
+ assertEquals("INVALID signature -- core validation failed.", ex.getCause().getMessage());
}
}
@@ -450,4 +454,4 @@ public class PhaosTest extends Assert {
StAX2DOM.readDoc(securityStreamReader);
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationReferenceURIResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationReferenceURIResolverTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationReferenceURIResolverTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationReferenceURIResolverTest.java Thu Jan 3 10:57:43 2019
@@ -45,12 +45,15 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.implementations.ResolverDirectHTTP;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
*/
public class SignatureCreationReferenceURIResolverTest extends AbstractSignatureCreationTest {
@@ -258,13 +261,13 @@ public class SignatureCreationReferenceU
}
NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/2000/09/xmldsig#", "Reference");
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
String uri = ((Element) nodeList.item(0)).getAttribute("URI");
- Assert.assertNotNull(uri);
- Assert.assertTrue(uri.startsWith("#xpointer"));
+ assertNotNull(uri);
+ assertTrue(uri.startsWith("#xpointer"));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationTest.java Thu Jan 3 10:57:43 2019
@@ -27,7 +27,6 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -58,6 +57,10 @@ import java.util.List;
import static org.apache.xml.security.stax.ext.XMLSecurityConstants.NS_C14N_EXCL;
import static org.apache.xml.security.stax.ext.XMLSecurityConstants.NS_XMLDSIG_ENVELOPED_SIGNATURE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* A set of test-cases for Signature creation.
@@ -110,7 +113,7 @@ public class SignatureCreationTest exten
while (childNode != null) {
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element)childNode;
- Assert.assertEquals(element.getLocalName(), "Signature");
+ assertEquals(element.getLocalName(), "Signature");
break;
}
childNode = childNode.getNextSibling();
@@ -208,10 +211,10 @@ public class SignatureCreationTest exten
try {
XmlReaderToWriter.writeAll(xmlStreamReader, xmlStreamWriter);
xmlStreamWriter.close();
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertTrue(e.getCause() instanceof XMLSecurityException);
- Assert.assertEquals("Part to sign not found: {urn:example:po}NotExistingElement", e.getCause().getMessage());
+ assertTrue(e.getCause() instanceof XMLSecurityException);
+ assertEquals("Part to sign not found: {urn:example:po}NotExistingElement", e.getCause().getMessage());
}
}
@@ -269,7 +272,7 @@ public class SignatureCreationTest exten
while (childNode != null) {
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element)childNode;
- Assert.assertEquals(element.getLocalName(), "Signature");
+ assertEquals(element.getLocalName(), "Signature");
break;
}
childNode = childNode.getNextSibling();
@@ -333,7 +336,7 @@ public class SignatureCreationTest exten
while (childNode != null) {
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element)childNode;
- Assert.assertEquals(element.getLocalName(), "Signature");
+ assertEquals(element.getLocalName(), "Signature");
break;
}
childNode = childNode.getNextSibling();
@@ -450,7 +453,7 @@ public class SignatureCreationTest exten
}
}
- Assert.assertEquals(childNode.getLocalName(), "Signature");
+ assertEquals(childNode.getLocalName(), "Signature");
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -621,7 +624,7 @@ public class SignatureCreationTest exten
String expression = "//dsig:Signature";
NodeList sigElements =
(NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET);
- Assert.assertTrue(sigElements.getLength() == 2);
+ assertTrue(sigElements.getLength() == 2);
for (SecurePart secPart : properties.getSignatureSecureParts()) {
if (secPart.getName() == null) {
@@ -630,13 +633,13 @@ public class SignatureCreationTest exten
expression = "//*[local-name()='" + secPart.getName().getLocalPart() + "']";
Element signedElement =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(signedElement);
+ assertNotNull(signedElement);
signedElement.setIdAttributeNS(null, "Id", true);
}
for (int i = 0; i < sigElements.getLength(); i++) {
XMLSignature signature = new XMLSignature((Element)sigElements.item(i), "");
- Assert.assertTrue(signature.checkSignatureValue(cert));
+ assertTrue(signature.checkSignatureValue(cert));
}
}
@@ -942,24 +945,24 @@ public class SignatureCreationTest exten
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_CanonicalizationMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_CanonicalizationMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_Transform.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_Transform.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_SignatureMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_SignatureMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals(XMLSecurityConstants.NS_XMLDSIG_RSASHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(XMLSecurityConstants.NS_XMLDSIG_RSASHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals(XMLSecurityConstants.NS_XMLDSIG_SHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(XMLSecurityConstants.NS_XMLDSIG_SHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -1010,24 +1013,24 @@ public class SignatureCreationTest exten
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_CanonicalizationMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_CanonicalizationMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_Transform.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_Transform.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(NS_C14N_EXCL, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_SignatureMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_SignatureMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals(XMLSecurityConstants.NS_XMLDSIG_RSASHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(XMLSecurityConstants.NS_XMLDSIG_RSASHA1, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
element = (Element)nodeList.item(0);
- Assert.assertEquals("http://www.w3.org/2001/04/xmlenc#sha256", element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals("http://www.w3.org/2001/04/xmlenc#sha256", element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -1125,9 +1128,9 @@ public class SignatureCreationTest exten
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces.getNamespaceURI(), XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces.getLocalPart());
- Assert.assertEquals(2, nodeList.getLength());
- Assert.assertEquals("", ((Element)nodeList.item(0)).getAttribute(XMLSecurityConstants.ATT_NULL_PrefixList.getLocalPart()));
- Assert.assertEquals("", ((Element)nodeList.item(1)).getAttribute(XMLSecurityConstants.ATT_NULL_PrefixList.getLocalPart()));
+ assertEquals(2, nodeList.getLength());
+ assertEquals("", ((Element)nodeList.item(0)).getAttribute(XMLSecurityConstants.ATT_NULL_PrefixList.getLocalPart()));
+ assertEquals("", ((Element)nodeList.item(1)).getAttribute(XMLSecurityConstants.ATT_NULL_PrefixList.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java Thu Jan 3 10:57:43 2019
@@ -46,10 +46,11 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.ext.XMLSecurityProperties;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* A set of test-cases for Signature creation with various digest algorithms
*/
@@ -130,9 +131,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -185,9 +186,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -240,9 +241,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -295,9 +296,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -350,9 +351,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -407,9 +408,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -464,9 +465,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -521,9 +522,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -578,9 +579,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -635,9 +636,9 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -692,12 +693,12 @@ public class SignatureDigestCreationTest
}
NodeList nodeList = document.getElementsByTagNameNS(XMLSecurityConstants.TAG_dsig_DigestMethod.getNamespaceURI(), XMLSecurityConstants.TAG_dsig_DigestMethod.getLocalPart());
- Assert.assertEquals(1, nodeList.getLength());
+ assertEquals(1, nodeList.getLength());
Element element = (Element)nodeList.item(0);
- Assert.assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
+ assertEquals(digestAlgorithm, element.getAttribute(XMLSecurityConstants.ATT_NULL_Algorithm.getLocalPart()));
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
}
-}
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureEncryptionTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureEncryptionTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureEncryptionTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureEncryptionTest.java Thu Jan 3 10:57:43 2019
@@ -24,7 +24,6 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.test.stax.utils.StAX2DOM;
import org.apache.xml.security.test.stax.utils.XmlReaderToWriter;
import org.apache.xml.security.utils.XMLUtils;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -48,6 +47,9 @@ import java.security.cert.X509Certificat
import java.util.ArrayList;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
/**
* A set of test-cases for Signature + Encryption.
*/
@@ -110,7 +112,7 @@ public class SignatureEncryptionTest ext
// Check the CreditCard decrypted ok
NodeList nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -118,8 +120,8 @@ public class SignatureEncryptionTest ext
TestSecurityEventListener testSecurityEventListener =
verifyUsingStAX(baos.toByteArray(), encryptionKey, cert.getPublicKey());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
}
@Test
@@ -179,7 +181,7 @@ public class SignatureEncryptionTest ext
// Check the CreditCard decrypted ok
NodeList nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -187,8 +189,8 @@ public class SignatureEncryptionTest ext
TestSecurityEventListener testSecurityEventListener =
verifyUsingStAX(baos.toByteArray(), encryptionKey, cert.getPublicKey());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.EncryptedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.EncryptedElement).size());
}
@Test
@@ -256,7 +258,7 @@ public class SignatureEncryptionTest ext
// Check the CreditCard decrypted ok
NodeList nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -264,8 +266,8 @@ public class SignatureEncryptionTest ext
TestSecurityEventListener testSecurityEventListener =
verifyUsingStAX(baos.toByteArray(), encryptionKey, cert.getPublicKey());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.EncryptedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.EncryptedElement).size());
}
@Test
@@ -333,7 +335,7 @@ public class SignatureEncryptionTest ext
// Check the CreditCard decrypted ok
NodeList nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
// Verify using DOM
verifyUsingDOM(document, cert, properties.getSignatureSecureParts());
@@ -341,8 +343,8 @@ public class SignatureEncryptionTest ext
TestSecurityEventListener testSecurityEventListener =
verifyUsingStAX(baos.toByteArray(), encryptionKey, cert.getPublicKey());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
}
@Test
@@ -413,13 +415,13 @@ public class SignatureEncryptionTest ext
// Check the CreditCard decrypted ok
NodeList nodeList = doc.getElementsByTagNameNS("urn:example:po", "CreditCard");
- Assert.assertEquals(nodeList.getLength(), 1);
+ assertEquals(nodeList.getLength(), 1);
TestSecurityEventListener testSecurityEventListener =
verifyUsingStAX(baos.toByteArray(), encryptionKey, cert.getPublicKey());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
- Assert.assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.SignedElement).size());
+ assertEquals(1, testSecurityEventListener.getSecurityEvents(SecurityEventConstants.ContentEncrypted).size());
}
@Test
@@ -441,9 +443,9 @@ public class SignatureEncryptionTest ext
try {
verifyUsingStAX(sourceDocument, encryptionKey, cert.getPublicKey());
- Assert.fail("Exception expected");
+ fail("Exception expected");
} catch (XMLStreamException e) {
- Assert.assertEquals("Unsecured message. Neither a Signature nor a EncryptedData element found.",
+ assertEquals("Unsecured message. Neither a Signature nor a EncryptedData element found.",
e.getCause().getMessage());
}
}
@@ -509,7 +511,7 @@ public class SignatureEncryptionTest ext
// transformer.transform(new DOMSource(document), new StreamResult(System.out));
NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "EncryptedData");
- Assert.assertEquals(nodeList.getLength(), 0);
+ assertEquals(nodeList.getLength(), 0);
return testSecurityEventListener;
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationReferenceURIResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationReferenceURIResolverTest.java?rev=1850225&r1=1850224&r2=1850225&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationReferenceURIResolverTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationReferenceURIResolverTest.java Thu Jan 3 10:57:43 2019
@@ -49,11 +49,12 @@ import org.apache.xml.security.test.stax
import org.apache.xml.security.test.stax.utils.TestUtils;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xml.security.utils.resolver.implementations.ResolverDirectHTTP;
-import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import static org.junit.Assert.assertNotNull;
+
/**
*/
public class SignatureVerificationReferenceURIResolverTest extends AbstractSignatureVerificationTest {
@@ -297,7 +298,7 @@ public class SignatureVerificationRefere
String expression = "//*[local-name()='ShippingAddress']";
Element elementToSign =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(elementToSign);
+ assertNotNull(elementToSign);
String id = UUID.randomUUID().toString();
elementToSign.setAttributeNS(null, "Id", id);
elementToSign.setIdAttributeNS(null, "Id", true);
@@ -370,7 +371,7 @@ public class SignatureVerificationRefere
String expression = "//*[local-name()='ShippingAddress']";
Element elementToSign =
(Element) xpath.evaluate(expression, document, XPathConstants.NODE);
- Assert.assertNotNull(elementToSign);
+ assertNotNull(elementToSign);
String id = UUID.randomUUID().toString();
elementToSign.setAttributeNS(null, "Id", id);
elementToSign.setIdAttributeNS(null, "Id", true);
@@ -483,4 +484,4 @@ public class SignatureVerificationRefere
StAX2DOM.readDoc(securityStreamReader);
}
-}
+}
\ No newline at end of file