### Question:
ExplicitBatchIndexApplier extends BatchTransactionApplier.Adapter { @Override public TransactionApplier startTx( CommandsToApply transaction ) throws IOException { long activeTransactionId = transaction.transactionId(); try { if ( txApplier == null ) { txApplier = new ExplicitIndexTransactionApplier( applierLookup, indexConfigStore, mode, transactionOrdering ); } if ( transaction.requiresApplicationOrdering() ) { transactionOrdering.waitFor( activeTransactionId ); if ( transaction.next() != null ) { txApplier.setTransactionId( activeTransactionId ); } else { lastTransactionId = activeTransactionId; } } return txApplier; } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); throw new IOException( "Interrupted while waiting for applying tx:" + activeTransactionId + " explicit index updates", e ); } } ExplicitBatchIndexApplier( IndexConfigStore indexConfigStore, ExplicitIndexApplierLookup applierLookup,
            IdOrderingQueue transactionOrdering, TransactionApplicationMode mode ); @Override TransactionApplier startTx( CommandsToApply transaction ); @Override void close();  }### Answer:
@Test public void shouldOnlyCreateOneApplierPerProvider() throws Exception { MutableObjectIntMap<String> names = ObjectIntHashMap.newWithKeysValues( "first", 0, "second", 1 ); MutableObjectIntMap<String> keys = ObjectIntHashMap.newWithKeysValues( "key", 0 ); String applierName = "test-applier"; Commitment commitment = mock( Commitment.class ); when( commitment.hasExplicitIndexChanges() ).thenReturn( true ); IndexConfigStore config = newIndexConfigStore( names, applierName ); ExplicitIndexApplierLookup applierLookup = mock( ExplicitIndexApplierLookup.class ); TransactionApplier transactionApplier = mock( TransactionApplier.class ); when( applierLookup.newApplier( anyString(), anyBoolean() ) ).thenReturn( transactionApplier ); try ( ExplicitBatchIndexApplier applier = new ExplicitBatchIndexApplier( config, applierLookup, BYPASS, INTERNAL ) ) { TransactionToApply tx = new TransactionToApply( null, 2 ); tx.commitment( commitment, 2 ); try ( TransactionApplier txApplier = applier.startTx( tx ) ) { IndexDefineCommand definitions = definitions( names, keys ); txApplier.visitIndexDefineCommand( definitions ); txApplier.visitIndexAddNodeCommand( addNodeToIndex( definitions, "first" ) ); txApplier.visitIndexAddNodeCommand( addNodeToIndex( definitions, "second" ) ); txApplier.visitIndexAddRelationshipCommand( addRelationshipToIndex( definitions, "second" ) ); } } verify( applierLookup, times( 1 ) ).newApplier( eq( applierName ), anyBoolean() ); }