### Question:
BesuEventsImpl implements BesuEvents { @Override public long addBlockAddedListener(final BlockAddedListener listener) { return blockchain.observeBlockAdded( event -> listener.onBlockAdded( blockAddedContext( event.getBlock()::getHeader, event.getBlock()::getBody, event::getTransactionReceipts))); } 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 addedBlockEventFiresAfterSubscribe() { final AtomicReference<AddedBlockContext> result = new AtomicReference<>(); serviceImpl.addBlockAddedListener(result::set); assertThat(result.get()).isNull(); final var block = gen.block( new BlockDataGenerator.BlockOptions() .setParentHash(blockchain.getGenesisBlock().getHash())); List<TransactionReceipt> transactionReceipts = gen.receipts(block); blockchain.appendBlock(block, transactionReceipts); assertThat(result.get()).isNotNull(); assertThat(result.get().getBlockHeader()).isEqualTo(block.getHeader()); assertThat(result.get().getTransactionReceipts()).isEqualTo(transactionReceipts); }