Source:
<code>public void testSameIndexFailure() throws Exception { lh = bkc.createLedger(5, 5, digestType, ledgerPassword); LedgerHandle mlh = spy(lh); LOG.info("Ledger ID: " + mlh.getId()); for (int i = 0; i < numEntriesToWrite; i++) { ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); } LedgerMetadata myMetadata = new LedgerMetadata(mlh.getLedgerMetadata()); long savedVersion = ((LongVersion) mlh.getLedgerMetadata().getVersion()).getLongVersion(); GenericCallbackFuture<Void> callbackFuture = new GenericCallbackFuture<>(); bkc.getLedgerManager().writeLedgerMetadata(mlh.getId(), myMetadata, callbackFuture); result(callbackFuture); lh.getLedgerMetadata().setVersion(new LongVersion(savedVersion)); BookieSocketAddress newBkAddr = startNewBookieAndReturnAddress(); CountDownLatch sleepLatch1 = new CountDownLatch(1); ArrayList<BookieSocketAddress> ensemble = mlh.getLedgerMetadata() .getEnsembles().entrySet().iterator().next().getValue(); sleepBookie(ensemble.get(0), sleepLatch1); Map<Integer, BookieSocketAddress> injectFailedBookies = new HashMap<Integer, BookieSocketAddress>(); injectFailedBookies.put(0, newBkAddr); when(mlh.testStubResolveConflict()).thenAnswer( invoke -> { <START> LOG.info("JV inside testInsertEnsembleChange"); <END> mlh.replaceBookieInMetadata(injectFailedBookies, 0); return true; }); ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); sleepLatch1.countDown(); }</code><technical_language>"JV inside"</technical_language>

Target:
public void testSameIndexFailure() throws Exception { lh = bkc.createLedger(5, 5, digestType, ledgerPassword); LedgerHandle mlh = spy(lh); LOG.info("Ledger ID: " + mlh.getId()); for (int i = 0; i < numEntriesToWrite; i++) { ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); } LedgerMetadata myMetadata = new LedgerMetadata(mlh.getLedgerMetadata()); long savedVersion = ((LongVersion) mlh.getLedgerMetadata().getVersion()).getLongVersion(); GenericCallbackFuture<LedgerMetadata> callbackFuture = new GenericCallbackFuture<>(); bkc.getLedgerManager().writeLedgerMetadata(mlh.getId(), myMetadata, callbackFuture); callbackFuture.get(); lh.getLedgerMetadata().setVersion(new LongVersion(savedVersion)); BookieSocketAddress newBkAddr = startNewBookieAndReturnAddress(); CountDownLatch sleepLatch1 = new CountDownLatch(1); List<BookieSocketAddress> ensemble = mlh.getLedgerMetadata() .getEnsembles().entrySet().iterator().next().getValue(); sleepBookie(ensemble.get(0), sleepLatch1); Map<Integer, BookieSocketAddress> injectFailedBookies = new HashMap<Integer, BookieSocketAddress>(); injectFailedBookies.put(0, newBkAddr); when(mlh.testStubResolveConflict()).thenAnswer( invoke -> { mlh.replaceBookieInMetadata(injectFailedBookies, 0); return true; }); ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); sleepLatch1.countDown(); }