@Test
public void testSubmitWithOnlyOneSubTransaction() throws InterruptedException {

    DOMStore configDomStore = mock(DOMStore.class);
    DOMStore operationalDomStore = mock(DOMStore.class);
    DOMStoreReadWriteTransaction mockStoreReadWriteTransaction = mock(DOMStoreReadWriteTransaction.class);
    DOMStoreThreePhaseCommitCohort mockCohort = mock(DOMStoreThreePhaseCommitCohort.class);
    doReturn(mockStoreReadWriteTransaction).when(operationalDomStore).newReadWriteTransaction();
    doReturn(mockCohort).when(mockStoreReadWriteTransaction).ready();
    doReturn(immediateFalseFluentFuture()).when(mockCohort).canCommit();
    doReturn(immediateNullFluentFuture()).when(mockCohort).abort();
    final CountDownLatch latch = new CountDownLatch(1);
    final List<DOMStoreThreePhaseCommitCohort> commitCohorts = new ArrayList<>();
    try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(
            LogicalDatastoreType.OPERATIONAL, operationalDomStore, LogicalDatastoreType.CONFIGURATION,
            configDomStore), futureExecutor) {
        @Override
        public FluentFuture<? extends CommitInfo> commit(DOMDataTreeWriteTransaction writeTx,
                Collection<DOMStoreThreePhaseCommitCohort> cohorts) {
            commitCohorts.addAll(cohorts);
            latch.countDown();
            return super.commit(writeTx, cohorts);
        }
    }) {
        DOMDataTreeReadWriteTransaction domDataReadWriteTransaction = dataBroker.newReadWriteTransaction();
        domDataReadWriteTransaction.delete(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty());
        domDataReadWriteTransaction.commit();
        assertTrue(latch.await(10, TimeUnit.SECONDS));
        assertTrue(commitCohorts.size() == 1);
    }
}