@Test public void Serialize_When_OreSettingHasNoValuesAndIsActivated_Expect_ReturnMapWithOneEntry() { for (final Ore ore : Ore.values()) { final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore); final Map<String, Object> map = oreSettingsYaml.serialize(); assertSame(1, map.size()); assertTrue(map.containsKey("ore")); assertEquals(ore.toString(), map.get("ore")); } }
@NotNull @Override public Map<String, Object> serialize() { final Map<String, Object> serialize = new HashMap<>(); serialize.put(ORE_KEY, getOre().toString()); if (!isActivated()) { serialize.put(STATUS_KEY, false); } final Map<Setting, Double> settingsMap = getSettings(); if (!settingsMap.isEmpty()) { final Map<String, Double> data = new LinkedHashMap<>(); settingsMap.forEach((key, value) -> data.put(key.toString(), value)); serialize.put(SETTINGS_KEY, data); } return serialize; }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Map<String, Object> serialize() { final Map<String, Object> serialize = new HashMap<>(); serialize.put(ORE_KEY, getOre().toString()); if (!isActivated()) { serialize.put(STATUS_KEY, false); } final Map<Setting, Double> settingsMap = getSettings(); if (!settingsMap.isEmpty()) { final Map<String, Double> data = new LinkedHashMap<>(); settingsMap.forEach((key, value) -> data.put(key.toString(), value)); serialize.put(SETTINGS_KEY, data); } return serialize; } }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Map<String, Object> serialize() { final Map<String, Object> serialize = new HashMap<>(); serialize.put(ORE_KEY, getOre().toString()); if (!isActivated()) { serialize.put(STATUS_KEY, false); } final Map<Setting, Double> settingsMap = getSettings(); if (!settingsMap.isEmpty()) { final Map<String, Double> data = new LinkedHashMap<>(); settingsMap.forEach((key, value) -> data.put(key.toString(), value)); serialize.put(SETTINGS_KEY, data); } return serialize; } OreSettingsYamlImpl(@NotNull final Ore ore);  OreSettingsYamlImpl(@NotNull final Ore ore, @NotNull final Map<Setting, Double> settings); }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Map<String, Object> serialize() { final Map<String, Object> serialize = new HashMap<>(); serialize.put(ORE_KEY, getOre().toString()); if (!isActivated()) { serialize.put(STATUS_KEY, false); } final Map<Setting, Double> settingsMap = getSettings(); if (!settingsMap.isEmpty()) { final Map<String, Double> data = new LinkedHashMap<>(); settingsMap.forEach((key, value) -> data.put(key.toString(), value)); serialize.put(SETTINGS_KEY, data); } return serialize; } OreSettingsYamlImpl(@NotNull final Ore ore);  OreSettingsYamlImpl(@NotNull final Ore ore, @NotNull final Map<Setting, Double> settings); @NotNull static OreSettingsYamlImpl deserialize(@NotNull final Map<String, Object> map); @NotNull @Override Ore getOre(); @NotNull @Override Optional<Double> getValue(@NotNull final Setting setting); @Override void setValue(@NotNull final Setting setting, final double value); @NotNull @Override Map<Setting, Double> getSettings(); @Override boolean isActivated(); @Override void setActivated(final boolean status); @NotNull @Override OreSettingsYamlImpl clone(); @Override boolean equals(@Nullable final Object object); @Override int hashCode(); @NotNull @Override Map<String, Object> serialize(); }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Map<String, Object> serialize() { final Map<String, Object> serialize = new HashMap<>(); serialize.put(ORE_KEY, getOre().toString()); if (!isActivated()) { serialize.put(STATUS_KEY, false); } final Map<Setting, Double> settingsMap = getSettings(); if (!settingsMap.isEmpty()) { final Map<String, Double> data = new LinkedHashMap<>(); settingsMap.forEach((key, value) -> data.put(key.toString(), value)); serialize.put(SETTINGS_KEY, data); } return serialize; } OreSettingsYamlImpl(@NotNull final Ore ore);  OreSettingsYamlImpl(@NotNull final Ore ore, @NotNull final Map<Setting, Double> settings); @NotNull static OreSettingsYamlImpl deserialize(@NotNull final Map<String, Object> map); @NotNull @Override Ore getOre(); @NotNull @Override Optional<Double> getValue(@NotNull final Setting setting); @Override void setValue(@NotNull final Setting setting, final double value); @NotNull @Override Map<Setting, Double> getSettings(); @Override boolean isActivated(); @Override void setActivated(final boolean status); @NotNull @Override OreSettingsYamlImpl clone(); @Override boolean equals(@Nullable final Object object); @Override int hashCode(); @NotNull @Override Map<String, Object> serialize();  }