Weather { public Map<String, Integer> getComponents() { HashMap<String, Integer> currentComponents = new HashMap<>(); for (WeatherComponent component : weatherComponents) { currentComponents.put(component.toString(), component.getLevel()); } return currentComponents; } Weather();  Weather(List<String> settings); @Override String toString(); WeatherType weatherType(); Map<String, Integer> getComponents(); Boolean load(List<String> settings); void onDeath(); void replace(WeatherType key, double val); String getPath();  }
@Test public void testGetComponents() { Weather weather = new Weather(); WeatherComponent random = new WeatherComponent("Random"); weather.addComponents(random); Assert.assertTrue( weather.getComponents().containsKey(random.getName())); if (weather.getComponents().containsKey(random.getName())) { Assert.assertEquals((long) random.getLevel(), (long) weather.getComponents().get(random.getName())); } else { Assert.assertFalse(true); } WeatherComponent other = new WeatherComponent("Other"); weather.addComponents(other); Assert.assertTrue( weather.getComponents().containsKey(other.getName())); if (weather.getComponents().containsKey(other.getName())) { Assert.assertEquals((long)other.getLevel(), (long)weather.getComponents().get(other.getName())); } else { Assert.assertFalse(true); } }