Add tests for conversion error repopulation with indexed properties#1391
Merged
lukaszlenart merged 1 commit intoOct 18, 2025
Merged
Conversation
This commit addresses recommendation #4 from the visitor pattern research: "Test repopulation behavior specifically with indexed properties to confirm it works as expected." Two new test methods have been added to VisitorFieldValidatorTest: 1. testArrayConversionErrorRepopulation() - Tests conversion errors in indexed array properties (testBeanArray[0].count, etc.) - Verifies that conversion errors are properly detected with correct indexed notation - Confirms repopulateField parameter preserves invalid values 2. testListConversionErrorRepopulation() - Tests conversion errors in indexed list properties (testBeanList[1].count, etc.) - Verifies proper field error key generation for list elements - Validates that elements without conversion errors don't generate false positives Supporting validation configuration files: - TestBean-validateArrayWithConversion-validation.xml - TestBean-validateListWithConversion-validation.xml - VisitorValidatorTestAction-validateArrayWithConversion-validation.xml - VisitorValidatorTestAction-validateListWithConversion-validation.xml These tests verify the VisitorFieldValidator correctly handles: - Conversion error detection for indexed properties - Field name construction with proper index notation - Error message generation for specific indexed elements - Selective validation (only elements with conversion errors fail) Research notes documenting the visitor pattern investigation are included in thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.md Also updated .claude/settings.json to refine permissions: - More specific WebFetch domain (struts.apache.org vs apache.org) - Added git checkout and git log permissions for better workflow 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
57c4f6b to
a41ae28
Compare
|
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.



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:Changes
New Test Methods
testArrayConversionErrorRepopulation()testBeanArray[0].count, etc.)repopulateFieldparameter preserves invalid values for re-displaytestListConversionErrorRepopulation()testBeanList[1].count, etc.)Supporting Configuration Files
TestBean-validateArrayWithConversion-validation.xmlTestBean-validateListWithConversion-validation.xmlVisitorValidatorTestAction-validateArrayWithConversion-validation.xmlVisitorValidatorTestAction-validateListWithConversion-validation.xmlDocumentation
thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.mdWhat is Verified
These tests confirm the VisitorFieldValidator correctly handles:
field[0].property)Test Plan
mvn test -Dtest=VisitorFieldValidatorTest -DskipAssemblyRelated Documentation
thoughts/lukaszlenart/notes/2025-10-17-struts2-iterator-validation-visitor-pattern.md🤖 Generated with Claude Code