Repository navigation
Conversation
…d HealthCheckValve
arturobernalg
suggested changes
Nov 21, 2026
arturobernalg
left a comment
Member
There was a problem hiding this comment.
This does not compile against current main: addServletMappingDecoded() was removed (65bb847), so it needs to be replaced with addServletMapping().
With that fixed the tests pass, but most of them don't test the valves:
TestJsonAccessLogValvenever reads the access log, so it still passes if the valve writes invalid JSON. The JSON output is already validated byTesterJsonAccessLogValveinTestAccessLogValve.- testCustomPath overlaps with the existing
testContextHealthCheck. - The getter/setter tests only exercise trivial or inherited
ErrorReportValvemethods.
testJsonErrorThrowableWithNullMessage is the only one that adds new coverage.
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 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:
JsonAccessLogValve
Added new test class TestJsonAccessLogValve covering:
HealthCheckValve
Extended TestHealthCheckValve to cover:
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:
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