feat: add JUnit 5 + Mockito unit tests for InfoServlet#74
Merged
Conversation
- pom.xml: junit-jupiter 5.14.4 + mockito-core 5.23.0 (test scope), surefire 3.5.6; profile-specific testSourceDirectory (src/test/java for tomcat9, src/test/java-jakarta for tomcat10/11) mirroring main sources - Tests assert doGet/doPost set text/html content-type and forward to index.jsp (javax + jakarta variants) - Exclude test-classes/ + surefire-reports/ from the WAR (the war-plugin webResource copies target/, which would otherwise leak test artifacts) - Load mockito-core as an explicit -javaagent via maven-dependency-plugin 3.11.0 properties goal — silences the JDK 21+ self-attach agent warning - README/CLAUDE.md: document the test suite (no longer "no-op") Verified: 2 tests pass on all 3 profiles AND across the JDK matrix bounds (11 and 25); make ci green; WAR free of test artifacts; zero warnings.
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.
Follow-up to #71 — makes
make testreal (was a no-op), the deferred test-coverage finding.Changes
junit-jupiter5.14.4 +mockito-core5.23.0 (test scope),maven-surefire-plugin3.5.6. Profile-specifictestSourceDirectorymirroring the main sources:src/test/java(javax/tomcat9),src/test/java-jakarta(jakarta/tomcat10/11).InfoServletTest(both variants): assertdoGet/doPostsettext/html;charset=UTF-8and forward toindex.jsp.test-classes/+surefire-reports/from the WAR (the pre-existing war-plugin webResource copies all oftarget/, which would otherwise leak test artifacts intoROOT.war).mockito-coreas an explicit-javaagentviamaven-dependency-plugin3.11.0 (propertiesgoal) → silences the JDK 21+ "Dynamic loading of agents will be disallowed" self-attach warning.Version choices (fact-checked)
Verification
make cigreen · WAR verified free of test artifacts · zero warnings on JDK 25.