onkar717 opened a new pull request, #981:
URL: https://github.com/apache/tomcat/pull/981

   ## Summary
   
   This PR improves test coverage for JsonErrorReportValve,
   JsonAccessLogValve and HealthCheckValve by adding tests for previously
   uncovered execution paths and configuration behavior.
   
   ## Motivation
   
   While reviewing Valve test coverage, a few remaining uncovered branches
   were identified in these classes, primarily related to property handling,
   pattern parsing and edge case behavior. This PR adds targeted tests to
   exercise those paths and improve overall reliability.
   
   ## Changes
   
   ### JsonErrorReportValve
   
   Extended existing TestJsonErrorReportValve with additional tests covering:
   
   - Throwable handling when message is null
   - Inherited setProperty/getProperty behavior
   - showReport and showServerInfo configuration handling
   
   ### JsonAccessLogValve
   
   Added new test class TestJsonAccessLogValve covering:
   
   - Default JSON log pattern behavior
   - Common and combined log patterns
   - Request/response header pattern handling
   - Cookie and session attribute pattern handling
   - createLogElements() behavior validation
   
   ### HealthCheckValve
   
   Extended TestHealthCheckValve to cover:
   
   - Property getters and setters
   - Custom health check path configuration
   - Container availability check configuration
   
   ## Testing
   
   All tests pass locally:
   
   ant clean test
   
   Targeted validation performed for the modified tests with no failures.
   
   Test results:
   
   TestJsonErrorReportValve:  Tests run: 13, Failures: 0, Errors: 0  
   TestJsonAccessLogValve:    Tests run: 6, Failures: 0, Errors: 0  
   TestHealthCheckValve:      Tests run: 4, Failures: 0, Errors: 0  
   
   ## Coverage Impact
   
   This PR increases coverage for:
   
   - JsonErrorReportValve (93% → improved)
   - JsonAccessLogValve (97% → improved)
   - HealthCheckValve (97% → improved)
   
   All realistically testable execution paths are now covered.
   
   ## Impact
   
   No functional changes.
   
   Test coverage improvement only.
   
   ## Files Changed
   
   TestJsonErrorReportValve.java  (modified)
   TestJsonAccessLogValve.java    (new)
   TestHealthCheckValve.java      (modified)
   
   ## Notes
   
   This PR is part of ongoing work to systematically improve Valve test
   coverage across Tomcat.
   
   ## Checklist
   
   - [x] Tests added
   - [x] Existing tests pass
   - [x] No functional changes
   - [x] ASF license headers included
   - [x] Changes limited to test code only
   - [x] Build verified with ant clean test


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to