### Question:
BesuEventsImpl implements BesuEvents { @Override public long addBlockReorgListener(final BlockReorgListener listener) { return blockchain.observeChainReorg( (blockWithReceipts, chain) -> listener.onBlockReorg( blockAddedContext( blockWithReceipts::getHeader, blockWithReceipts.getBlock()::getBody, blockWithReceipts::getReceipts))); } BesuEventsImpl(
      final Blockchain blockchain,
      final BlockBroadcaster blockBroadcaster,
      final TransactionPool transactionPool,
      final SyncState syncState); @Override long addBlockPropagatedListener(final BlockPropagatedListener listener); @Override void removeBlockPropagatedListener(final long listenerIdentifier); @Override long addBlockAddedListener(final BlockAddedListener listener); @Override void removeBlockAddedListener(final long listenerIdentifier); @Override long addBlockReorgListener(final BlockReorgListener listener); @Override void removeBlockReorgListener(final long listenerIdentifier); @Override long addTransactionAddedListener(final TransactionAddedListener listener); @Override void removeTransactionAddedListener(final long listenerIdentifier); @Override long addTransactionDroppedListener(
      final TransactionDroppedListener transactionDroppedListener); @Override void removeTransactionDroppedListener(final long listenerIdentifier); @Override long addSyncStatusListener(final SyncStatusListener syncStatusListener); @Override void removeSyncStatusListener(final long listenerIdentifier); @Override long addLogListener(
      final List<Address> addresses,
      final List<List<Bytes32>> topics,
      final LogListener logListener); @Override void removeLogListener(final long listenerIdentifier);  }### Answer:
@Test public void reorgedBlockEventFiresAfterSubscribe() { final AtomicReference<AddedBlockContext> result = new AtomicReference<>(); serviceImpl.addBlockReorgListener(result::set); assertThat(result.get()).isNull(); final var block = gen.block( new BlockDataGenerator.BlockOptions() .setParentHash(blockchain.getGenesisBlock().getHash()) .setBlockNumber(blockchain.getGenesisBlock().getHeader().getNumber() + 1)); blockchain.appendBlock(block, gen.receipts(block)); assertThat(result.get()).isNull(); final var reorgBlock = gen.block( new BlockDataGenerator.BlockOptions() .setParentHash(blockchain.getGenesisBlock().getHash()) .setBlockNumber(blockchain.getGenesisBlock().getHeader().getNumber() + 2)); List<TransactionReceipt> transactionReceipts = gen.receipts(reorgBlock); blockchain.appendBlock(reorgBlock, transactionReceipts); assertThat(result.get()).isNotNull(); assertThat(result.get().getBlockHeader()).isEqualTo(reorgBlock.getHeader()); assertThat(result.get().getTransactionReceipts()).isEqualTo(transactionReceipts); }