### Question:
ShardInfoDownloader { public Map<Long, Double> getShardRelativeWeights() { Map<Long, Double> res = new HashMap<>(); if (sortedByIdShards.isEmpty()) { return res; } for (Long shardId : sortedByIdShards.keySet()) { Double k = 1.0 * shardId / sortedByIdShards.keySet().size(); Double weight = getShardWeight(shardId) * k; res.put(shardId, weight); } Long predefined = readManuallyDefinedShardId(); if (predefined != null) { boolean exists = res.get(predefined) != null; if (exists) { res.replace(predefined, 20.0D); log.info("Downloading of shard {} is forced by enviromnent variable", predefined); } else { log.info("Shard ID {} predefined in environment variable is not usable or does not exist", predefined); } } return res; } @Inject  ShardInfoDownloader(PeersService peers); void setShardInfoByPeers(Map<String, ShardingInfo> testData); void processAllPeersShardingInfo(); boolean processPeerShardingInfo(String pa, ShardingInfo si); ShardingInfo getShardingInfoFromPeer(String addr); Map<String, ShardingInfo> getShardInfoFromPeers(); ShardInfo getShardInfo(Long shardId); double getShardWeight(Long shardId); Map<Long, Double> getShardRelativeWeights(); static final String SHARD_ID_ENV; }### Answer:
@Test public void testGetShardRelativeWeights() { downloader.setShardInfoByPeers(shardInfoByPeers_ALL_GOOD); downloader.processAllPeersShardingInfo(); Map<Long, Double> result = downloader.getShardRelativeWeights(); int size = result.size(); result.keySet().forEach((id) -> { log.debug("Shard: {} RelWeight: {}", id, result.get(id)); }); assertEquals(size, 3); }