- doReturn(Futures.immediateFailedCheckedFuture(new DOMException((short) 414, "Post request failed"))).when(this.readWrite).submit();
- final TransactionVarsWrapper wrapper = new TransactionVarsWrapper(payload.getInstanceIdentifierContext(), null, this.transactionChain);
- final Response response =
- PostDataTransactionUtil.postData(this.uriInfo, payload, wrapper, this.refSchemaCtx, null, null);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR, response.getStatusInfo());
+ final DOMException domException = new DOMException((short) 414, "Post request failed");
+ doReturn(Futures.immediateFailedCheckedFuture(domException)).when(this.readWrite).submit();
+ final TransactionVarsWrapper wrapper =
+ new TransactionVarsWrapper(payload.getInstanceIdentifierContext(), null, this.transactionChain);
+
+ try {
+ PostDataTransactionUtil.postData(this.uriInfo, payload, wrapper, this.refSchemaCtx, null, null);
+ fail("Expected RestconfDocumentedException");
+ } catch (RestconfDocumentedException e) {
+ assertEquals(1, e.getErrors().size());
+ assertTrue(e.getErrors().get(0).getErrorInfo().contains(domException.getMessage()));
+ }
+