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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to