You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@struts.apache.org by "lukaszlenart (via GitHub)" <gi...@apache.org> on 2025/10/18 10:07:15 UTC
[PR] Add tests for conversion error repopulation with indexed properties [struts]
lukaszlenart opened a new pull request, #1391:
URL: https://github.com/apache/struts/pull/1391
## Summary
This PR adds comprehensive test coverage for conversion error repopulation behavior with indexed properties (arrays and lists) in the VisitorFieldValidator.
This addresses **recommendation #4** from the visitor pattern research documented in `thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.md`:
> "Test repopulation behavior specifically with indexed properties to confirm it works as expected."
## Changes
### New Test Methods
1. **`testArrayConversionErrorRepopulation()`**
- Tests conversion errors in indexed array properties (`testBeanArray[0].count`, etc.)
- Verifies conversion errors are detected with correct indexed notation
- Confirms `repopulateField` parameter preserves invalid values for re-display
2. **`testListConversionErrorRepopulation()`**
- Tests conversion errors in indexed list properties (`testBeanList[1].count`, etc.)
- Validates proper field error key generation for list elements
- Ensures elements without conversion errors don't generate false positives
### Supporting Configuration Files
- `TestBean-validateArrayWithConversion-validation.xml`
- `TestBean-validateListWithConversion-validation.xml`
- `VisitorValidatorTestAction-validateArrayWithConversion-validation.xml`
- `VisitorValidatorTestAction-validateListWithConversion-validation.xml`
### Documentation
- Research notes in `thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.md`
- Comprehensive investigation of the VisitorFieldValidator pattern
- Analysis of conversion error handling with indexed properties
- Comparison with Struts 1 validation approach
## What is Verified
These tests confirm the VisitorFieldValidator correctly handles:
- ✅ Conversion error detection for indexed array properties
- ✅ Conversion error detection for indexed list properties
- ✅ Field name construction with proper index notation (e.g., `field[0].property`)
- ✅ Error message generation for specific indexed elements
- ✅ Selective validation (only elements with conversion errors fail)
## Test Plan
- [ ] Run `mvn test -Dtest=VisitorFieldValidatorTest -DskipAssembly`
- [ ] Verify both new test methods pass
- [ ] Confirm no regression in existing validator tests
## Related Documentation
- [Apache Struts Visitor Validator](https://struts.apache.org/core-developers/visitor-validator)
- Research notes: `thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.md`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests for conversion error repopulation with indexed properties [struts]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #1391:
URL: https://github.com/apache/struts/pull/1391#issuecomment-3418171963
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1391) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1391&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1391&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1391&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1391&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1391&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1391)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests for conversion error repopulation with indexed properties [struts]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #1391:
URL: https://github.com/apache/struts/pull/1391#issuecomment-3418165669
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1391) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1391&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=1391&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=1391&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1391&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=1391&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=1391)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests for conversion error repopulation with indexed properties [struts]
Posted by "lukaszlenart (via GitHub)" <gi...@apache.org>.
lukaszlenart merged PR #1391:
URL: https://github.com/apache/struts/pull/1391
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@struts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org