### Question:
GenesisHandler implements Eth1EventsChannel { @Override public void onDepositsFromBlock(final DepositsFromBlockEvent event) { if (!recentChainData.isPreGenesis()) { return; } LOG.trace( "Processing {} deposits from block {}", event.getDeposits().size(), event.getBlockNumber()); final List<DepositWithIndex> deposits = event.getDeposits().stream() .map(DepositUtil::convertDepositEventToOperationDeposit) .collect(Collectors.toList()); processNewData(event.getBlockHash(), event.getBlockTimestamp(), deposits); } GenesisHandler(final RecentChainData recentChainData); @Override void onDepositsFromBlock(final DepositsFromBlockEvent event); @Override void onMinGenesisTimeBlock(MinGenesisTimeBlockEvent event);  }### Answer:
@Test public void onDepositsFromBlock_shouldInitializeGenesis() { final UInt64 genesisTime = Constants.MIN_GENESIS_TIME; final int batchSize = INITIAL_DEPOSIT_DATA.size() / 2; final DepositsFromBlockEvent event1 = DepositsFromBlockEvent.create( UInt64.valueOf(100), dataStructureUtil.randomBytes32(), UInt64.ZERO, INITIAL_DEPOSITS.stream().limit(batchSize)); final DepositsFromBlockEvent event2 = DepositsFromBlockEvent.create( UInt64.valueOf(100), dataStructureUtil.randomBytes32(), genesisTime, INITIAL_DEPOSITS.stream().skip(batchSize)); assertThat(storageSystem.recentChainData().isPreGenesis()).isTrue(); genesisHandler.onDepositsFromBlock(event1); assertThat(storageSystem.recentChainData().isPreGenesis()).isTrue(); genesisHandler.onDepositsFromBlock(event2); assertThat(storageSystem.recentChainData().isPreGenesis()).isFalse(); }
@Test public void onDepositsFromBlock_missingFirstEvent() { final DepositsFromBlockEvent event = dataStructureUtil.randomDepositsFromBlockEvent(UInt64.ONE, 1, 11); assertThatThrownBy(() -> genesisHandler.onDepositsFromBlock(event)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining("Expected next deposit at index 0, but got 1"); }
@Test public void onDepositsFromBlock_missingRangeOfEvents() { final DepositsFromBlockEvent event1 = dataStructureUtil.randomDepositsFromBlockEvent(UInt64.valueOf(10), 0, 10); final DepositsFromBlockEvent event3 = dataStructureUtil.randomDepositsFromBlockEvent(UInt64.valueOf(12), 15, 20); genesisHandler.onDepositsFromBlock(event1); assertThatThrownBy(() -> genesisHandler.onDepositsFromBlock(event3)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining("Expected next deposit at index 10, but got 15"); }