Merge changes I6575ddd8,I4b78f51d,I0a0441e6
[netconf.git] / netconf / netconf-netty-util / src / test / java / org / opendaylight / netconf / nettyutil / handler / NetconfXMLToMessageDecoderTest.java
index ea5bd62df6c6991ab5455486f52475bb658519f5..8600253f36c0ff39506fb5b4c6e7434195577f43 100644 (file)
@@ -9,11 +9,13 @@
 package org.opendaylight.netconf.nettyutil.handler;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.Lists;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import org.junit.Test;
+import org.opendaylight.netconf.api.FailedNetconfMessage;
 import org.xml.sax.SAXParseException;
 
 public class NetconfXMLToMessageDecoderTest {
@@ -57,12 +59,15 @@ public class NetconfXMLToMessageDecoderTest {
         assertEquals(1, out.size());
     }
 
-    @Test(expected = SAXParseException.class)
+    @Test
     public void testDecodeGibberish() throws Exception {
         /* Test that we reject inputs where we cannot find the xml start '<' character */
         final ArrayList<Object> out = Lists.newArrayList();
         new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("\r\n?xml version>".getBytes()), out);
         assertEquals(1, out.size());
+        assertTrue(FailedNetconfMessage.class.isInstance(out.get(0)));
+        assertTrue(((FailedNetconfMessage) out.get(0))
+                .getException().getClass().isAssignableFrom(SAXParseException.class));
     }
 
     @Test