SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction<T> implements DOMStoreWriteTransaction, SnapshotBackedTransaction { @SuppressWarnings("checkstyle:IllegalCatch") @Override public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) { checkNotReady(); final DataTreeModification tree = mutableTree; LOG.debug("Tx: {} Merge: {}:{}", getIdentifier(), path, data); try { tree.merge(path, data); } catch (Exception e) { LOG.error("Tx: {}, failed to merge {}:{} in {}", getIdentifier(), path, data, tree, e); Throwables.throwIfUnchecked(e); throw new IllegalArgumentException("Illegal input data.", e); } } SnapshotBackedWriteTransaction(final T identifier, final boolean debug,
            final DataTreeSnapshot snapshot, final TransactionReadyPrototype<T> readyImpl); @SuppressWarnings("checkstyle:IllegalCatch") @Override void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data); @SuppressWarnings("checkstyle:IllegalCatch") @Override void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data); @SuppressWarnings("checkstyle:IllegalCatch") @Override void delete(final YangInstanceIdentifier path); @SuppressWarnings("checkstyle:IllegalCatch") @Override DOMStoreThreePhaseCommitCohort ready(); @Override void close(); @Override Optional<DataTreeSnapshot> getSnapshot();  }
@Test(expected = IllegalArgumentException.class) public void mergeWithException() throws Exception { doAnswer(inv -> { throw new TestException(); }).when(DATA_TREE_MODIFICATION).merge(any(), any()); snapshotBackedWriteTransaction.merge(YangInstanceIdentifier.empty(), NORMALIZED_NODE); }