### Question:
LazyBlock implements Block { public static void listenForLoads(Block block, Consumer<Block> listener) { requireNonNull(block, "block is null"); requireNonNull(listener, "listener is null"); LazyData.addListenersRecursive(block, singletonList(listener)); } LazyBlock(int positionCount, LazyBlockLoader loader); @Override int getPositionCount(); @Override int getSliceLength(int position); @Override byte getByte(int position, int offset); @Override short getShort(int position, int offset); @Override int getInt(int position, int offset); @Override long getLong(int position, int offset); @Override Slice getSlice(int position, int offset, int length); @Override T getObject(int position, Class<T> clazz); @Override boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length); @Override int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength); @Override void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder); @Override void writePositionTo(int position, BlockBuilder blockBuilder); @Override boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length); @Override long hash(int position, int offset, int length); @Override int compareTo(int leftPosition, int leftOffset, int leftLength, Block rightBlock, int rightPosition, int rightOffset, int rightLength); @Override Block getSingleValueBlock(int position); @Override long getSizeInBytes(); @Override long getRegionSizeInBytes(int position, int length); @Override long getPositionsSizeInBytes(boolean[] positions); @Override long getRetainedSizeInBytes(); @Override long getEstimatedDataSizeForStats(int position); @Override void retainedBytesForEachPart(BiConsumer<Object, Long> consumer); @Override String getEncodingName(); @Override Block getPositions(int[] positions, int offset, int length); @Override Block copyPositions(int[] positions, int offset, int length); @Override Block getRegion(int positionOffset, int length); @Override Block copyRegion(int position, int length); @Override boolean isNull(int position); @Override final List<Block> getChildren(); Block getBlock(); @Override boolean isLoaded(); @Override Block getLoadedBlock(); static void listenForLoads(Block block, Consumer<Block> listener);  }### Answer:
@Test public void testNestedListener() { List<Block> actualNotifications = new ArrayList<>(); LazyBlock lazyBlock = new LazyBlock(1, TestLazyBlock::createInfiniteRecursiveRowBlock); LazyBlock.listenForLoads(lazyBlock, actualNotifications::add); List<Block> expectedNotifications = new ArrayList<>(); assertNotificationsRecursive(5, lazyBlock, actualNotifications, expectedNotifications); }