SnapshotBackedReadTransaction extends
        AbstractDOMStoreTransaction<T> implements DOMStoreReadTransaction, SnapshotBackedTransaction { @SuppressWarnings("checkstyle:IllegalCatch") @Override public FluentFuture<Optional<NormalizedNode<?,?>>> read(final YangInstanceIdentifier path) { LOG.debug("Tx: {} Read: {}", getIdentifier(), path); requireNonNull(path, "Path must not be null."); final DataTreeSnapshot snapshot = stableSnapshot; if (snapshot == null) { return FluentFutures.immediateFailedFluentFuture(new ReadFailedException("Transaction is closed")); } try { return FluentFutures.immediateFluentFuture(snapshot.readNode(path)); } catch (Exception e) { LOG.error("Tx: {} Failed Read of {}", getIdentifier(), path, e); return FluentFutures.immediateFailedFluentFuture(new ReadFailedException("Read failed", e)); } } SnapshotBackedReadTransaction(final T identifier, final boolean debug, final DataTreeSnapshot snapshot,
            final TransactionClosePrototype<T> closeImpl); @Override void close(); @SuppressWarnings("checkstyle:IllegalCatch") @Override FluentFuture<Optional<NormalizedNode<?,?>>> read(final YangInstanceIdentifier path); @Override FluentFuture<Boolean> exists(final YangInstanceIdentifier path); @Override Optional<DataTreeSnapshot> getSnapshot();  }
@SuppressWarnings({ "checkstyle:IllegalThrows", "checkstyle:avoidHidingCauseException" }) @Test(expected = ReadFailedException.class) public void readNodeTestWithException() throws Throwable { doThrow(new NullPointerException("no Node")).when(DATA_TREE_SNAPSHOT).readNode(any()); snapshotBackedReadTransaction = new SnapshotBackedReadTransaction<>(new Object(), false, DATA_TREE_SNAPSHOT, null); try { snapshotBackedReadTransaction.read(YangInstanceIdentifier.empty()).get(); fail("Expected ReadFailedException"); } catch (Exception e) { throw e.getCause(); } }