Remove jodd-wot from fields tests - #15965
Conversation
Replace the Jerry-based spec assertions with direct output checks and remove the unused jodd-wot test dependency wiring. Assisted-by: opencode:gpt-5.5
There was a problem hiding this comment.
Pull request overview
This PR removes the jodd-wot test dependency from the grails-fields module by replacing the prior DOM-parsing assertions in DefaultFieldTemplateSpec with direct string-based Spock assertions, and then cleaning up the related Gradle dependency and version property wiring.
Changes:
- Refactored
DefaultFieldTemplateSpecto dropJerry/jerryusage and assert against rendered output strings. - Removed
org.jodd:jodd-wotfromgrails-fieldstest dependencies. - Removed the now-unused
joddWotVersionproperty fromgradle.properties.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| grails-fields/src/test/groovy/grails/plugin/formfields/DefaultFieldTemplateSpec.groovy | Removes Lagarto/Jerry usage and replaces DOM assertions with string assertions for default/invalid/required rendering. |
| grails-fields/build.gradle | Drops the jodd-wot test dependency block (and its excludes). |
| gradle.properties | Removes the unused joddWotVersion property. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15965 +/- ##
==================================================
+ Coverage 49.5558% 51.4835% +1.9277%
- Complexity 16930 17777 +847
==================================================
Files 1999 2039 +40
Lines 93753 95586 +1833
Branches 16419 16591 +172
==================================================
+ Hits 46460 49211 +2751
+ Misses 40131 39064 -1067
- Partials 7162 7311 +149 🚀 New features to boost your workflow:
|
|
I'm not a fan of the string comparisons - they're fragile and brittle. Why are we not using a standard html parser? |
|
Fair point on the brittleness. Worth separating the goal from the assertion style: The primary objective (pre-release review, Codebase 3 / hygiene quick-win) is to remove the On how to replace the assertion, the review lists two options: "modern assertions" or "Jsoup or equivalent". The trade-off:
I'm happy to switch these to Jsoup ( |
|
I'm happy with Jsoup, it's a parser that's well understood. I think we need to parse these values though, especially with some of the refactoring we've talked about. Otherwise, the tests are too brittle. |
jdaugherty flagged the string-based assertions this PR introduced as fragile (exact-serialization matching instead of semantic checks), and Copilot independently raised the same concern per-assertion. jamesfredley proposed the trade-off directly: stay dependency-free with tightened (regex) assertions, or trade the removed jodd-wot for a real, modern parser (Jsoup). jdaugherty chose Jsoup explicitly, anticipating more HTML-structure-sensitive tests from planned refactoring. Reimplements the three DefaultFieldTemplateSpec assertions against org.jsoup instead of raw strings, restoring the exact semantic checks the original jodd-wot/Jerry version had (root div has the fieldcontain/ error/required class tokens - order and other-attributes insensitive - label text/for-attribute, label immediately precedes the input, and the required-indicator span's text) rather than the newly-added brittle literal-markup comparisons. jsoup has no existing version management in this repo; added jsoupVersion to gradle.properties following the same pattern already used for javassistVersion/jnrPosixVersion, since it's a single-module, test-only dependency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ All tests passed ✅🏷️ Commit: 3b8b35f Learn more about TestLens at testlens.app. |
Summary
Removes the
jodd-wottest dependency fromgrails-fieldsby replacing its only usage with direct Spock string assertions against the rendered field output.Changes
grails-fieldstestsjodd.lagarto.dom.jerry.Jerryimports and helper usage inDefaultFieldTemplateSpec.grails-fieldsdependenciesorg.jodd:jodd-wotfrom test dependencies.joddWotVersionproperty.Verification
./gradlew.bat :grails-fields:test --tests "grails.plugin.formfields.DefaultFieldTemplateSpec"./gradlew.bat :grails-fields:testChecklist
jodd-wot/joddreferences.