Repository navigation
Add characterization tests for the LDIF parser (29% -> 70% line coverage) - #118
Open
opravil-jan wants to merge 2 commits into
Open
opravil-jan wants to merge 2 commits into
opravil-jan wants to merge 2 commits into
Conversation
junit-platform-runner pulled JUnit 4 onto the test classpath, so surefire auto-detected the JUnit4 provider and discovered none of the Jupiter tests: every plugin module reported "Tests run: 0" and the build stayed green. Nothing uses the runner, so drop it together with the now unused junit.platform.version property. Hamcrest was only reachable transitively through JUnit 4; its single user, EntryEditorWidgetSorterTest, now asserts with JUnit's assertEquals like the other test classes. Surefire now runs 360 unit tests across 10 plugins (2 skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…model Pin down the current behaviour of content and change records (add, delete, modify, moddn), controls, folding, base64 and URL values, invalid input, round-tripping, LdifUtils and LdifFile, so that upcoming fixes cannot silently change anything else. Line coverage of the plugin goes from 29% to 70%. Tests that describe the correct behaviour of known or suspected bugs are @disabled with the reason, to be enabled together with the fix: file:// URL values, folding with line width 1, a trailing delete record without an empty line, and records with a garbage line being reported valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This PR changes tests only; no production code is touched. It pins down the current behaviour of
plugins/ldifparser, so that later fixes in the parser cannot silently change anything else.What is covered
There are 8 new test classes with 62 tests in total. They cover:
dn::andattr::values (UTF-8),version:lines, comments, multiple records, CRLF and LF line endings.add:/replace:/delete:with-separators), and modrdn/moddn withnewrdn,deleteoldrdnandnewsuperior.toFormattedStringat several line widths, and a raw round trip of a mixed file.LdifUtilsand theLdifFilehelpers.LdifParserLdifValueLineBaseCoverage was measured with JaCoCo 0.8.15. Every test class was mutation-checked: I broke one targeted line of production code, confirmed that a test fails, and then reverted the change.
Known and suspected bugs (tests are
@Disabled, not cemented)These tests assert the correct behaviour. Each one fails on the current code for the stated reason (I checked this by enabling them). They are meant to be enabled together with the fix:
LdifValueLineUrlTest.testFileUrlIsReadattr:< file:///pathis treated as a plain file path (new File(value)), so the value comes back emptyLdifFileFormatTest.testFoldingWithLineWidthOneTerminatesLdifLineBase.foldloops forever for line width 1 (offset = lineWidth - 1 = 0). This test runs in a daemon thread, so enabling it before the fix cannot hang the test JVM.LdifChangeRecordParserTest.testChangeTypeDeleteAtEndOfFileWithoutEmptyLineIsValidLdifChangeDeleteRecord.isValid()requires a trailing separator line, so a final delete record without an empty line is rejected by the LDIF importLdifInvalidInputParserTest.testRecordWithGarbageLineIsInvalidLdifContainer.isAbstractValid()returnstrueas soon as the first line is valid and never checks the remaining parts, so a record containing a garbage line is reported valid and gets importedVerification
mvn clean install(Maven 3.9.16, JDK 17): ldifparser has 76 tests, of which 72 pass and 4 are skipped (the disabled tests above).🤖 Generated with Claude Code