You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/04/17 11:27:06 UTC
(camel) 01/01: Fix unit test as the xml dumper may have changed recently
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch xfix
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f7a391ec845121592532388a2c41f406d7f9f78e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Apr 17 13:26:56 2024 +0200
Fix unit test as the xml dumper may have changed recently
---
.../org/apache/camel/util/DumpModelAsXmlNamespaceTest.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
index a5a72c9f259..6ff68ae0b63 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/DumpModelAsXmlNamespaceTest.java
@@ -43,13 +43,19 @@ public class DumpModelAsXmlNamespaceTest extends ContextTestSupport {
NodeList nl = dom.getElementsByTagName("xpath");
assertEquals(2, nl.getLength());
- Element n1 = (Element) nl.item(0);
- String attributeFoo = n1.getAttribute("xmlns:foo");
+ String attributeFoo = dom.getDocumentElement().getAttribute("xmlns:foo");
+ if (attributeFoo.isEmpty()) {
+ Element n1 = (Element) nl.item(0);
+ attributeFoo = n1.getAttribute("xmlns:foo");
+ }
assertNotNull(attributeFoo);
assertEquals(URL_FOO, attributeFoo);
- Element n2 = (Element) nl.item(1);
- String attributeBar = n2.getAttribute("xmlns:bar");
+ String attributeBar = dom.getDocumentElement().getAttribute("xmlns:bar");
+ if (attributeBar.isEmpty()) {
+ Element n1 = (Element) nl.item(0);
+ attributeBar = n1.getAttribute("xmlns:bar");
+ }
assertNotNull(attributeBar);
assertEquals(URL_BAR, attributeBar);
}