### Question:
ShardInfoDownloader { public double getShardWeight(Long shardId) { Objects.requireNonNull(shardId, "shardId is NULL"); double res = 0.0D; int allPeersNumber = shardInfoByPeers.size(); Set<PeerFileHashSum> goodPeers = goodPeersMap.get(shardId); int goodPeersNumber = (goodPeers == null ? 0 : goodPeers.size()); Set<PeerFileHashSum> badPeers = badPeersMap.get(shardId); int badPeersNumber = (badPeers == null ? 0 : badPeers.size()); int noShardPeersNumber = allPeersNumber - (goodPeersNumber + badPeersNumber); res = (1.0 * goodPeersNumber - 1.0 * badPeersNumber - 1.0 * noShardPeersNumber) / allPeersNumber; 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 testGetShardWeight() { downloader.setShardInfoByPeers(shardInfoByPeers_ALL_GOOD); downloader.processAllPeersShardingInfo(); double expResult = 0.7; for (long i = 1; i <= downloader.getShardsDesisons().size(); i++) { double result = downloader.getShardWeight(i); assertEquals(result > expResult, true); log.debug("Shard: {} weight: {}", i, result); } }