### Question:
DataStoreHelper { public static <T extends DataObject> Optional<T> readFromDs(LogicalDatastoreType store, InstanceIdentifier<T> path, ReadTransaction rTx) { CheckedFuture<Optional<T>, ReadFailedException> resultFuture = rTx.read(store, path); try { return resultFuture.checkedGet(); } catch (ReadFailedException e) { LOG.warn("Read failed from DS.", e); return Optional.absent(); } }  static Optional<T> readFromDs(LogicalDatastoreType store, InstanceIdentifier<T> path, ReadTransaction rTx); static boolean submitToDs(WriteTransaction wTx); static Optional<T> removeIfExists(LogicalDatastoreType store, InstanceIdentifier<T> path,
            ReadWriteTransaction rwTx);  }### Answer:
@Test public void testReadFromDs() throws Exception { Optional<?> optional = mock(Optional.class); when(readFuture.checkedGet()).thenReturn((Optional) optional); Assert.assertEquals(optional, DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL, mock(InstanceIdentifier.class), readTransaction)); }
@Test public void testReadFromDs_Exception() throws Exception { doThrow(new ReadFailedException(EXCEPTION_MESSAGE)).when(readFuture).checkedGet(); Assert.assertEquals(Optional.absent(), DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL, mock(InstanceIdentifier.class), readTransaction)); }