### Question:
ShardManager { public boolean addNewShard(final Shard shard) { var shardId = shard.getId(); if (!shardMap.containsKey(shardId)) { shardMap.put(shardId, shard); return true; } else { return false; } } ShardManager(); boolean addNewShard(final Shard shard); boolean removeShardById(final int shardId); Shard getShardById(final int shardId); abstract int storeData(final Data data);  }### Answer:
@Test public void testAddNewShard() { try { var shard = new Shard(1); shardManager.addNewShard(shard); var field = ShardManager.class.getDeclaredField("shardMap"); field.setAccessible(true); var map = (Map<Integer, Shard>) field.get(shardManager); Assert.assertEquals(1, map.size()); Assert.assertEquals(shard, map.get(1)); } catch (NoSuchFieldException | IllegalAccessException e) { Assert.fail("Fail to modify field access."); } }