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;
@Test
public void serializeNullSchemaContextNegativeTest() {
this.thrown.expect(NullPointerException.class);
- YangInstanceIdentifierSerializer.create(null, YangInstanceIdentifier.EMPTY);
+ YangInstanceIdentifierSerializer.create(null, YangInstanceIdentifier.empty());
}
/**
*/
@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() {
.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);
}
/**
* 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
.node(child)
.build();
- this.thrown.expect(IllegalArgumentException.class);
+ this.thrown.expect(RestconfDocumentedException.class);
YangInstanceIdentifierSerializer.create(this.schemaContext, data);
}
}