1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-07 19:41:11 +01:00

Change Element.toXml() to toXml(String enclosingNamespace)

This commit is contained in:
Florian Schmaus 2018-04-25 14:20:18 +02:00
parent 380f9a2b72
commit 5ab2903c32
229 changed files with 634 additions and 536 deletions

View file

@ -41,10 +41,10 @@ public class HashElementTest extends SmackTestSuite {
String message = "Hello World!";
HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message));
String expected = "<hash xmlns='urn:xmpp:hashes:2' algo='sha-256'>f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=</hash>";
assertEquals(expected, element.toXML().toString());
assertEquals(expected, element.toXML(null).toString());
HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected));
assertEquals(expected, parsed.toXML().toString());
assertEquals(expected, parsed.toXML(null).toString());
assertEquals(SHA_256, parsed.getAlgorithm());
assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64());
assertArrayEquals(HashManager.sha_256(message), parsed.getHash());