### Question:
TransactionInvokerImpl implements TransactionInvoker,TransactionChainListener, Runnable, AutoCloseable { @VisibleForTesting synchronized List<TransactionCommand> extractResubmitCommands() { Transaction transaction = failedTransactionQueue.poll(); List<TransactionCommand> commands = new ArrayList<>(); if (transaction != null) { final Iterator<Entry<ReadWriteTransaction, TransactionCommand>> it = pendingTransactions.iterator(); while (it.hasNext()) { final Entry<ReadWriteTransaction, TransactionCommand> current = it.next(); if (transaction.equals(current.getKey())) { commands.add(current.getValue()); it.forEachRemaining(entry -> commands.add(entry.getValue())); break; } } resetTransactionQueue(); } return commands; } TransactionInvokerImpl(final DataBroker db); @VisibleForTesting  TransactionInvokerImpl(final DataBroker db, final ExecutorService executor); @VisibleForTesting  TransactionInvokerImpl(final DataBroker db,
            final List<Entry<ReadWriteTransaction, TransactionCommand>> pendingTransactions,
            final List<ReadWriteTransaction> failedTransactions); @VisibleForTesting  TransactionInvokerImpl(final DataBroker db,
            final List<Entry<ReadWriteTransaction, TransactionCommand>> pendingTransactions); @Override void invoke(final TransactionCommand command); @Override void onTransactionChainFailed(final TransactionChain chainArg,
            final Transaction transaction, final Throwable cause); @Override void onTransactionChainSuccessful(final TransactionChain chainArg); @Override void run(); @Override void close();  }### Answer:
@Test public void testExtractResubmitCommands() { final ReadWriteTransaction tx1 = mock(ReadWriteTransaction.class); final ReadWriteTransaction tx2 = mock(ReadWriteTransaction.class); final ReadWriteTransaction tx3 = mock(ReadWriteTransaction.class); final TransactionCommand cmd1 = mock(TransactionCommand.class); final TransactionCommand cmd2 = mock(TransactionCommand.class); final TransactionCommand cmd3 = mock(TransactionCommand.class); final TransactionInvokerImpl invoker = new TransactionInvokerImpl(db, ImmutableList.of(entry(tx1, cmd1), entry(tx2, cmd2), entry(tx3, cmd3)), Collections.singletonList(tx2)); assertEquals(ImmutableList.of(cmd2, cmd3), invoker.extractResubmitCommands()); }