Fixed wrong exception types
[netconf.git] / restconf / restconf-nb-rfc8040 / src / test / java / org / opendaylight / restconf / nb / rfc8040 / utils / parser / YangInstanceIdentifierSerializerTest.java
index 69bca5b373944e9fe96202f09e91811aa901fe76..36ee08edc3daea01a230bf4cf2c88094c9707d3c 100644 (file)
@@ -18,6 +18,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
+import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
 import org.opendaylight.restconf.nb.rfc8040.utils.parser.builder.ParserBuilderConstants;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -190,7 +191,7 @@ public class YangInstanceIdentifierSerializerTest {
     @Test
     public void serializeNullSchemaContextNegativeTest() {
         this.thrown.expect(NullPointerException.class);
-        YangInstanceIdentifierSerializer.create(null, YangInstanceIdentifier.EMPTY);
+        YangInstanceIdentifierSerializer.create(null, YangInstanceIdentifier.empty());
     }
 
     /**
@@ -211,13 +212,14 @@ public class YangInstanceIdentifierSerializerTest {
      */
     @Test
     public void serializeEmptyDataTest() {
-        final String result = YangInstanceIdentifierSerializer.create(this.schemaContext, YangInstanceIdentifier.EMPTY);
+        final String result = YangInstanceIdentifierSerializer.create(this.schemaContext,
+            YangInstanceIdentifier.empty());
         assertTrue("Empty identifier is expected", result.isEmpty());
     }
 
     /**
      * Negative test when it is not possible to find child node of current node. Test is expected to fail with
-     * <code>IllegalArgumentException</code> and error message is compared to expected error message.
+     * <code>RestconfDocumentedException</code> and error message is compared to expected error message.
      */
     @Test
     public void serializeChildNodeNotFoundNegativeTest() {
@@ -226,7 +228,7 @@ public class YangInstanceIdentifierSerializerTest {
                 .node(QName.create("serializer:test", "2016-06-06", "not-existing-leaf"))
                 .build();
 
-        this.thrown.expect(IllegalArgumentException.class);
+        this.thrown.expect(RestconfDocumentedException.class);
         YangInstanceIdentifierSerializer.create(this.schemaContext, data);
     }
 
@@ -310,7 +312,7 @@ public class YangInstanceIdentifierSerializerTest {
     /**
      * Test of serialization when nodes in input <code>YangInstanceIdentifier</code> are defined in two different
      * modules by using augmentation. Augmented node in data supplied for serialization has wrong namespace.
-     * <code>IllegalArgumentException</code> is expected because augmented node is defined in other module than its
+     * <code>RestconfDocumentedException</code> is expected because augmented node is defined in other module than its
      * parent and will not be found.
      */
     @Test
@@ -326,7 +328,7 @@ public class YangInstanceIdentifierSerializerTest {
                 .node(child)
                 .build();
 
-        this.thrown.expect(IllegalArgumentException.class);
+        this.thrown.expect(RestconfDocumentedException.class);
         YangInstanceIdentifierSerializer.create(this.schemaContext, data);
     }
 }