InMemoryDOMStoreThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { @Override public ListenableFuture<Void> commit() { checkState(candidate != null, "Proposed subtree must be computed"); store.commit(candidate); return SUCCESSFUL_FUTURE; } InMemoryDOMStoreThreePhaseCommitCohort(final InMemoryDOMDataStore store,
                                           final SnapshotBackedWriteTransaction<String> writeTransaction,
                                           final DataTreeModification modification,
                                           final Exception operationError); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Boolean> canCommit(); @SuppressWarnings("checkstyle:IllegalCatch") @Override final ListenableFuture<Void> preCommit(); @Override final ListenableFuture<Void> abort(); @Override ListenableFuture<Void> commit();  }
@Test public void commitTest() throws Exception { doNothing().when(IN_MEMORY_DOM_DATA_STORE).commit(any()); doReturn(DATA_TREE_CANDIDATE).when(IN_MEMORY_DOM_DATA_STORE).prepare(any()); inMemoryDOMStoreThreePhaseCommitCohort.preCommit(); inMemoryDOMStoreThreePhaseCommitCohort.commit(); verify(IN_MEMORY_DOM_DATA_STORE).commit(any()); }