### Question:
MdsalUtils { public <D extends DataObject> D read( final LogicalDatastoreType store, final InstanceIdentifier<? extends DataObject> path) { Optional<D> optionalDataObject = readOptional(store, path); if (optionalDataObject.isPresent()) { return optionalDataObject.get(); } LOG.debug("{}: Failed to read {}", Thread.currentThread().getStackTrace()[1], path); return null; } MdsalUtils(DataBroker dataBroker); boolean delete(
            final LogicalDatastoreType store, final InstanceIdentifier<D> path); boolean merge(
            final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data); boolean put(
            final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data); D read(
            final LogicalDatastoreType store, final InstanceIdentifier<? extends DataObject> path); Optional<D> readOptional(
            final LogicalDatastoreType store, final InstanceIdentifier<? extends DataObject> path); boolean exists(
        final LogicalDatastoreType store, final InstanceIdentifier<? extends DataObject> path);  }### Answer:
@Test public void testRead() { ReadTransaction readTransaction = mock(ReadTransaction.class); doReturn(readTransaction).when(databroker).newReadOnlyTransaction(); DataObject obj = mock(DataObject.class); doReturn(FluentFutures.immediateFluentFuture(Optional.of(obj))).when(readTransaction).read( any(LogicalDatastoreType.class), any(InstanceIdentifier.class)); DataObject result = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, mock(InstanceIdentifier.class)); verify(readTransaction, times(1)).read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class)); verify(readTransaction, times(1)).close(); assertEquals("Error, the read transaction failed", obj, result); }