feat: add comprehensive test coverage using maven-plugin-testing-harness 3.5.1#154
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/hazendaz/xml-format-maven-plugin/sessions/f495bdb7-df11-4ace-9855-bcde912d4562 Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
…ess 3.5.1 - Add maven-plugin-testing-harness 3.5.1, junit:junit:4.13.2, and plexus-xml:4.1.1 test deps - LineEndingTest: cover all enum values and getChars() for SYSTEM/LF/CRLF/CR - XmlOutputFormatTest: cover constructor defaults and keepBlankLines getter/setter - IOTest: add hash(File) tests for file-based hashing, same-content and different-content scenarios - FormatUtilTest: add needsFormatting direct tests (empty/formatted/unformatted) and formatInPlace for empty files - XmlCheckPluginTest: add pluginSkip test - AbstractXmlPluginMojoRuleTest: 16 harness-based tests covering tabIndent, lineEnding (CRLF/CR), keepBlankLines, expandEmptyElements, indentSize, suppressDeclaration, omitEncoding, skip, and xml-check pass/fail/skip scenarios Agent-Logs-Url: https://github.com/hazendaz/xml-format-maven-plugin/sessions/f495bdb7-df11-4ace-9855-bcde912d4562 Co-authored-by: hazendaz <975267+hazendaz@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
hazendaz
April 12, 2026 01:58
View session
hazendaz
approved these changes
Apr 12, 2026
hazendaz
approved these changes
Apr 12, 2026
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
Increases test coverage from 23 tests to 63 tests (+40 new tests) by adding new test classes and extending existing ones. Integrates the maven-plugin-testing-harness 3.5.1 to exercise private
@Parameterfields that have no package-private setters.Changes
New test dependencies (
pom.xml)org.apache.maven.plugin-testing:maven-plugin-testing-harness:3.5.1— testing harnessjunit:junit:4.13.2— required at test compile scope (MojoRule implements JUnit 4 TestRule)org.codehaus.plexus:plexus-xml:4.1.1— providesXmlStreamReader/Xpp3Dommoved out ofplexus-utils:4.0+New test classes
LineEndingTestLineEndingenum values,getChars(),values(),valueOf()XmlOutputFormatTestindent,newlines,trimText,padText,keepBlankLines),setKeepBlankLinesround-tripsAbstractXmlPluginMojoRuleTestMojoRule.setVariableValueToObjectto configure private@Parameterfields:tabIndent,lineEnding(CRLF, CR),keepBlankLines,expandEmptyElements,indentSize,suppressDeclaration,omitEncoding,skip; xml-check pass / fail / skip scenariossrc/test/resources/it/pom.xmlExtended test classes
IOTesthash(File)method coverage; same-content and different-content hash comparisonsFormatUtilTestneedsFormattingtests (empty / already-formatted / unformatted);formatInPlaceon empty fileXmlCheckPluginTestpluginSkip— verifies skip=true prevents execution even with unformatted filesHarness integration notes
MojoRule(Maven 3 API, JUnit 4 Rule) is adapted for JUnit 5 via a privateTestMojoRule extends MojoRuleinner class that promotesbefore()/after()topublic, then wires them to@BeforeEach/@AfterEach. The harness is used specifically for itssetVariableValueToObjectreflection utility, which reaches into private@Parameterfields that have no package-private setters — demonstrating exactly the testing use-case the harness was designed for.