vmassol (SVN) wrote:
Author: vmassol
Date: 2008-10-28 09:19:23 +0100 (Tue, 28 Oct 2008)
New Revision: 13864
Added:
platform/core/trunk/xwiki-rendering/src/test/java/org/xwiki/rendering/block/XMLBlockTest.java
Modified:
platform/core/trunk/xwiki-rendering/src/main/java/org/xwiki/rendering/block/XMLBlock.java
Log:
XWIKI-2785: The order in which XML attributes are printed when converted to XWiki syntax
is not fixed
+ public void testAttributeOrder()
+ {
+ Map<String, String> attributes = new HashMap<String, String>();
+ attributes.put("aaa", "value1");
+ attributes.put("bbb", "value2");
+ XMLBlock block = new XMLBlock("element", attributes);
+
+ Iterator<String> it = attributes.keySet().iterator();
+ Iterator<String> newIt = block.getAttributes().keySet().iterator();
+ while (it.hasNext()) {
+ assertEquals(newIt.next(), it.next());
+ }
+ }
I'm not sure this test is enough, since the order for two attributes
could happen to be the same. Why not add 10 attributes (aN = vN, where N
goes from 0 to 9)?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/