### Question:
ShardImporter { public boolean canImport(int height) { if (height == 0) { return true; } else if (blockchainConfig.getCurrentConfig().isShardingEnabled()) { Shard shard = shardDao.getLastShard(); if (shard != null) { return shard.getShardState() == ShardState.FULL || shard.getShardState() == ShardState.CREATED_BY_ARCHIVE; } else { return true; } } return true; } @Inject  ShardImporter(ShardDao shardDao, BlockchainConfig blockchainConfig, GenesisImporter genesisImporter, Blockchain blockchain, DerivedTablesRegistry derivedTablesRegistry, CsvImporter csvImporter, Zip zipComponent, DataTagDao dataTagDao, DownloadableFilesManager downloadableFilesManager, AplAppStatus aplAppStatus); void importShardByFileId(ShardPresentData shardPresentData); void importLastShard(int height); boolean canImport(int height); void importShard(ShardPresentData shardPresentData, List<String> excludedTables);  }### Answer:
@Test void testCanImportForZeroHeight() { boolean result = shardImporter.canImport(0); assertTrue(result); }
@Test void testCanImportForDisabledSharding() { HeightConfig heightConfig = mock(HeightConfig.class); doReturn(heightConfig).when(blockchainConfig).getCurrentConfig(); boolean result = shardImporter.canImport(1); assertTrue(result); }
@Test void testCanImportForEnabledShardingWithoutStoredShads() { HeightConfig heightConfig = mock(HeightConfig.class); doReturn(true).when(heightConfig).isShardingEnabled(); doReturn(heightConfig).when(blockchainConfig).getCurrentConfig(); boolean result = shardImporter.canImport(1); assertTrue(result); }
@Test void testCanImportForEnableShardingWithFullLastShard() { HeightConfig heightConfig = mock(HeightConfig.class); doReturn(true).when(heightConfig).isShardingEnabled(); doReturn(heightConfig).when(blockchainConfig).getCurrentConfig(); Shard lastShard = new Shard(); lastShard.setShardState(ShardState.FULL); doReturn(lastShard).when(shardDao).getLastShard(); boolean result = shardImporter.canImport(1); assertTrue(result); }
@Test void testCanImportForEnabledShardingWithArchiveLastShard() { HeightConfig heightConfig = mock(HeightConfig.class); doReturn(true).when(heightConfig).isShardingEnabled(); doReturn(heightConfig).when(blockchainConfig).getCurrentConfig(); Shard lastShard = new Shard(); lastShard.setShardState(ShardState.CREATED_BY_ARCHIVE); doReturn(lastShard).when(shardDao).getLastShard(); boolean result = shardImporter.canImport(1); assertTrue(result); }
@Test void testCanImportForEnabledShardingWithInitStateForLastShard() { HeightConfig heightConfig = mock(HeightConfig.class); doReturn(true).when(heightConfig).isShardingEnabled(); doReturn(heightConfig).when(blockchainConfig).getCurrentConfig(); Shard lastShard = new Shard(); lastShard.setShardState(ShardState.INIT); doReturn(lastShard).when(shardDao).getLastShard(); boolean result = shardImporter.canImport(1); assertFalse(result); }