test(ItemUtils): add unit tests + String-based overloads for enchantment helpers - #22
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
matchesEnchantment(String, int, String)andformatEnchantmentName(String)overloads so the helpers can be unit-tested without instantiatingEnchantment(whose static initializer requires a live Bukkit server).formatNumberup next toapplyCustomModelDataso related formatting helpers cluster together (was buried at the end of the file).ItemUtilsTestwith 24 cases coveringformatEnchantmentName,toRoman, andmatchesEnchantmentacross name/level/raw-key/case/whitespace paths.Local
mvn testis green: 30/30 (24 new + 6 existing NetworkTest).