Bug 8153: Enforce check-style rules for netconf - netconf-util
[netconf.git] / netconf / netconf-util / src / test / java / org / opendaylight / netconf / util / xml / XMLNetconfUtilTest.java
index f70406bb2cc357e927606043e5562974762e1755..3ca07d4dd438e21e73db8a11837bae2146ae6839 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.util.xml;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import javax.xml.xpath.XPathConstants;
@@ -25,8 +26,11 @@ public class XMLNetconfUtilTest {
         try {
             XMLNetconfUtil.compileXPath("!@(*&$!");
             fail("Incorrect xpath should fail");
-        } catch (IllegalStateException e) {}
-        final Object value = XmlUtil.evaluateXPath(correctXPath, XmlUtil.readXmlToDocument("<top><innerText>value</innerText></top>"), XPathConstants.NODE);
+        } catch (IllegalStateException e) {
+            assertTrue(e.getMessage().startsWith("Error while compiling xpath expression "));
+        }
+        final Object value = XmlUtil.evaluateXPath(correctXPath,
+                XmlUtil.readXmlToDocument("<top><innerText>value</innerText></top>"), XPathConstants.NODE);
         assertEquals("value", ((Element) value).getTextContent());
     }