### Question:
TrimObserver { public int onBlockPushed(@Observes @BlockEvent(BlockEventType.BLOCK_PUSHED) Block block) { int scheduleTrimHeight = -1; if (block.getHeight() % trimFrequency == 0) { boolean isConfigJustUpdated = blockchainConfig.isJustUpdated(); HeightConfig currentConfig = blockchainConfig.getCurrentConfig(); boolean shardingEnabled = currentConfig.isShardingEnabled(); log.debug("Is sharding DISabled ? : '{}' || '{}' on height={}", !shardingEnabled, isShardingOff, block.getHeight()); int randomTrimHeightIncrease = 0; if (!shardingEnabled || isShardingOff) { randomTrimHeightIncrease = generatePositiveIntBiggerThenZero(trimFrequency); log.trace("'Not sharded', trim height random increase = {}", randomTrimHeightIncrease); } else { int trimHeight = Math.max(0, (block.getHeight() - maxRollback)); int shardingFrequency; if (!isConfigJustUpdated) { shardingFrequency = currentConfig.getShardingFrequency(); } else { shardingFrequency = blockchainConfig.getPreviousConfig().isPresent() && blockchainConfig.getPreviousConfig().get().isShardingEnabled() ? blockchainConfig.getPreviousConfig().get().getShardingFrequency() : currentConfig.getShardingFrequency(); } boolean isShardingOnTrimHeight = (Math.max(trimHeight, 0)) % shardingFrequency == 0; boolean isShardingOnBlockHeight = block.getHeight() % shardingFrequency == 0; randomTrimHeightIncrease = generatePositiveIntBiggerThenZero(trimFrequency); if (isShardingOnBlockHeight || isShardingOnTrimHeight) { randomTrimHeightIncrease = 0; } else if (trimService.isTrimming()) { log.debug("Schedule next trim SKIPPED={}, trimHeight = {} / {}, shardFreq={} ({}}), isShardingOnTrimHeight={}, isShardingOnBlockHeight={}", randomTrimHeightIncrease, trimHeight, block.getHeight(), shardingFrequency, isConfigJustUpdated, isShardingOnTrimHeight, isShardingOnBlockHeight); return scheduleTrimHeight; } log.debug("Schedule next trim for rndIncrease={}, height/trimHeight = {} / {}, shardFreq={} ({}}), isShardingOnTrimHeight={}, isShardingOnBlockHeight={}", randomTrimHeightIncrease, trimHeight, block.getHeight(), shardingFrequency, isConfigJustUpdated, isShardingOnTrimHeight, isShardingOnBlockHeight); } synchronized (lock) { scheduleTrimHeight = block.getHeight() + randomTrimHeightIncrease; log.debug("Schedule next trim for height={} at {}", scheduleTrimHeight, block.getHeight()); trimHeights.add(scheduleTrimHeight); } } else { log.trace("Skip Trim schedule on block height='{}' NOT div % by trimFreq={}", block.getHeight(), trimFrequency); } return scheduleTrimHeight; } @Inject  TrimObserver(TrimService trimService, BlockchainConfig blockchainConfig,
                        PropertiesHolder propertiesHolder, Random random,
                        Blockchain blockchain); void onTrimConfigUpdated(@Observes @TrimConfigUpdated TrimConfig trimConfig); void onBlockScanned(@Observes @BlockEvent(BlockEventType.BLOCK_SCANNED) Block block); int onBlockPushed(@Observes @BlockEvent(BlockEventType.BLOCK_PUSHED) Block block);  }### Answer:
@Test void testOnBlockPushed() { doReturn(5000).when(config).getShardingFrequency(); fireBlockPushed(4999); fireBlockPushed(5000); fireBlockPushed(6000); fireBlockPushed(6001); }