### Question:
Shard { public void storeData(Data data) { dataStore.put(data.getKey(), data); } Shard(final int id); void storeData(Data data); void clearData(); Data getDataById(final int id); int getId();  }### Answer:
@Test public void testStoreData() { try { shard.storeData(data); var field = Shard.class.getDeclaredField("dataStore"); field.setAccessible(true); var dataMap = (Map<Integer, Data>) field.get(shard); Assert.assertEquals(1, dataMap.size()); Assert.assertEquals(data, dataMap.get(1)); } catch (NoSuchFieldException | IllegalAccessException e) { Assert.fail("Fail to modify field access."); } }