use of org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot in project mdsal by opendaylight.
the class InMemoryDataStoreTest method testReadWithReadWriteTransactionFailure.
@SuppressWarnings("checkstyle:IllegalThrows")
@Test(expected = ReadFailedException.class)
public void testReadWithReadWriteTransactionFailure() throws Throwable {
DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
Mockito.doThrow(new RuntimeException("mock ex")).when(mockModification).readNode(Mockito.any(YangInstanceIdentifier.class));
Mockito.doReturn(mockModification).when(mockSnapshot).newModification();
@SuppressWarnings("unchecked") TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot, mockReady);
doReadAndThrowEx(readTx);
}
Aggregations