@Test public void GetValue_When_SettingIsNotPresent_Expect_ReturnEmptyOptional() { for (Ore ore : Ore.values()) { final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore); for (Setting setting : Setting.values()) assertFalse(oreSettingsYaml.getValue(setting).isPresent()); } for (Ore ore : Ore.values()) { final OreSettingsYamlImpl oreSettingsYaml = new OreSettingsYamlImpl(ore, new HashMap<>()); for (Setting setting : Setting.values()) assertFalse(oreSettingsYaml.getValue(setting).isPresent()); } }
@NotNull @Override public Optional<Double> getValue(@NotNull final Setting setting) { Validate.notNull(setting, "Setting cannot be null"); return Optional.ofNullable(getSettings().get(setting)); }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Optional<Double> getValue(@NotNull final Setting setting) { Validate.notNull(setting, "Setting cannot be null"); return Optional.ofNullable(getSettings().get(setting)); } }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Optional<Double> getValue(@NotNull final Setting setting) { Validate.notNull(setting, "Setting cannot be null"); return Optional.ofNullable(getSettings().get(setting)); } OreSettingsYamlImpl(@NotNull final Ore ore);  OreSettingsYamlImpl(@NotNull final Ore ore, @NotNull final Map<Setting, Double> settings); }
OreSettingsYamlImpl implements ConfigurationSerializable, OreSettings { @NotNull @Override public Optional<Double> getValue(@NotNull final Setting setting) { Validate.notNull(setting, "Setting cannot be null"); return Optional.ofNullable(getSettings().get(setting)); } 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 Optional<Double> getValue(@NotNull final Setting setting) { Validate.notNull(setting, "Setting cannot be null"); return Optional.ofNullable(getSettings().get(setting)); } 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();  }