Skip to content

test(ItemUtils): add unit tests + String-based overloads for enchantment helpers - #22

Merged
DerMoha merged 1 commit into
mainfrom
test/enchantment-string-overloads
Jul 25, 2026
Merged

test(ItemUtils): add unit tests + String-based overloads for enchantment helpers#22
DerMoha merged 1 commit into
mainfrom
test/enchantment-string-overloads

Conversation

@DerMoha

@DerMoha DerMoha commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Companion follow-up to #17. The substring-duplicate bug fix landed via ags816710's PR; this adds the regression coverage that was prepared alongside it but got lost in the rebasing race.

  • Package-private matchesEnchantment(String, int, String) and formatEnchantmentName(String) overloads so the helpers can be unit-tested without instantiating Enchantment (whose static initializer requires a live Bukkit server).
  • Move formatNumber up next to applyCustomModelData so related formatting helpers cluster together (was buried at the end of the file).
  • New ItemUtilsTest with 24 cases covering formatEnchantmentName, toRoman, and matchesEnchantment across name/level/raw-key/case/whitespace paths.

Local mvn test is green: 30/30 (24 new + 6 existing NetworkTest).

…ent helpers

- Add package-private matchesEnchantment(String, int, String) and
  formatEnchantmentName(String) overloads so the helpers can be exercised
  in unit tests without instantiating org.bukkit.enchantments.Enchantment
  (whose static initializer requires a live Bukkit server).
- Rename shadowed 'rawName' to 'normalizedRaw' in the String overload for
  clarity.
- Move formatNumber up next to applyCustomModelData so related formatting
  helpers cluster together (was buried at the end of the file).
- Add ItemUtilsTest with 24 cases covering formatEnchantmentName, toRoman,
  and matchesEnchantment across name/level/raw-key/case/whitespace paths.

Companion follow-up to #17 (the substring-duplicate bug fix landed there
via ags816710's PR; this commit adds the regression coverage).

Co-authored-by: ags816710 <57810175+ags816710@users.noreply.github.com>
@DerMoha
DerMoha merged commit d4005fe into main Jul 25, 2026
1 check passed
@DerMoha
DerMoha deleted the test/enchantment-string-overloads branch July 25, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant