Raise base test coverage#935
Merged
Merged
Conversation
Add and extend Kotlin `Spec` tests across the `base` module, raising line coverage from ~89.6% to ~96.5%. New and extended suites close actionable gaps in the `query`, `code.proto`, `type`, `io`, `string`, and `protobuf` packages — covering value-object equality, query expression distribution, descriptor/file-set parsing, stringifier singletons, and assorted error paths. Tests are written in Kotlin with Kotest assertions and Guava `EqualsTester`, following the house `Spec` conventions. No production code is modified. Also convert `@Nested` groups to the backticked-name layout, removing `@DisplayName` from `@Nested inner class`es per the kotlin-jvm-tester convention. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
base test coverage to ~96%base test coverage
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request primarily increases test coverage in the :base module by adding new Kotlin/JUnit 5 + Kotest specs and extending existing tests to hit previously uncovered branches and value semantics. It also updates snapshot/versioning metadata and introduces buildSrc Kover/TestKit coverage wiring (not reviewed here per repo rules for buildSrc/**).
Changes:
- Added/extended
:basemodule tests coveringtype,query,code.proto,io,protobuf,string, andbaseutilities. - Bumped the published snapshot version from
2.0.0-SNAPSHOT.401to2.0.0-SNAPSHOT.402and refreshed generated dependency documentation. - Added
buildSrclogic to collect/merge TestKit worker JaCoCo.execdata into Kover reports (skipped in review perbuildSrc/**rule).
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps snapshot version to .402. |
| docs/dependencies/pom.xml | Updates documented BOM version to .402. |
| docs/dependencies/dependencies.md | Refreshes generated dependency report for .402. |
| buildSrc/src/main/kotlin/io/spine/gradle/testing/TestKitCoverage.kt | Adds TestKit JaCoCo agent wiring (skipped: buildSrc/**). |
| buildSrc/src/main/kotlin/io/spine/gradle/report/coverage/KoverConfig.kt | Merges TestKit .exec into Kover totals (skipped: buildSrc/**). |
| base/src/test/kotlin/io/spine/type/TypeMiscSpec.kt | Adds coverage for EnumType.toProto(). |
| base/src/test/kotlin/io/spine/type/TypeMembersSpec.kt | Adds/extends tests for TypeUrl, MessageType, ServiceType, and UnknownTypeException. |
| base/src/test/kotlin/io/spine/type/KnownTypesSpec.kt | Extends tests for KnownTypes.toString() and deserialization behavior. |
| base/src/test/kotlin/io/spine/type/JsonSpec.kt | Adds error-path tests for malformed JSON parsing and unknown-type JSON printing. |
| base/src/test/kotlin/io/spine/string/StringifierSingletonsSpec.kt | Verifies built-in stringifiers preserve singleton identity after deserialization. |
| base/src/test/kotlin/io/spine/string/StringifierRegistryMissingSpec.kt | Adds negative test for missing stringifier registration. |
| base/src/test/kotlin/io/spine/query/QueryValueObjectsSpec.kt | Adds value semantics and predicate/id criterion coverage for query value objects. |
| base/src/test/kotlin/io/spine/query/EntityQuerySpec.kt | Adds coverage for custom-column criterion and transformed query building. |
| base/src/test/kotlin/io/spine/query/DistributionSpec.kt | Adds distributive-law coverage for complex AND/OR expressions. |
| base/src/test/kotlin/io/spine/query/ComparisonOperatorSymbolsSpec.kt | Verifies ComparisonOperator.toString() symbols. |
| base/src/test/kotlin/io/spine/query/ColumnsSpec.kt | Adds delegation/immutability coverage for Columns. |
| base/src/test/kotlin/io/spine/protobuf/Durations2ConverterSpec.kt | Adds coverage for Durations2 conversion and converter naming. |
| base/src/test/kotlin/io/spine/io/ResourceTest.kt | Extends tests for Resource.read, locateAll error path, and equality semantics. |
| base/src/test/kotlin/io/spine/io/ResourceDirectorySpec.kt | Adds equality semantics coverage for ResourceDirectory. |
| base/src/test/kotlin/io/spine/io/IoMiscSpec.kt | Adds coverage for Files2.systemTempDir() and Glob.extensionLowerAndUpper(). |
| base/src/test/kotlin/io/spine/io/DeleteSpec.kt | Adds coverage for recursive delete and shutdown-hook registration. |
| base/src/test/kotlin/io/spine/code/proto/SourceFileSpec.kt | Adds coverage for SourceFile wrapper behavior. |
| base/src/test/kotlin/io/spine/code/proto/PackageNameAndFieldNameSpec.kt | Adds coverage for PackageName and FieldName helpers. |
| base/src/test/kotlin/io/spine/code/proto/MessageTypeSpec.kt | Extends tests for proto conversion, signal detection, field lookup, UUID-value check. |
| base/src/test/kotlin/io/spine/code/proto/LinkerSpec.kt | Adds coverage for partial resolution, toString, and validation error wrapping. |
| base/src/test/kotlin/io/spine/code/proto/FileSetSpec.kt | Extends coverage for FileSet union/of/parse/parseAsKnownFiles and formatting. |
| base/src/test/kotlin/io/spine/code/proto/FileDescriptorSetReaderSpec.kt | Adds coverage for parse/tryParse for bytes and streams, including malformed input. |
| base/src/test/kotlin/io/spine/code/proto/FieldDescriptorProtoExtsSpec.kt | Normalizes nested test group naming to backticked layout. |
| base/src/test/kotlin/io/spine/code/proto/FieldDeclarationSpec.kt | Extends coverage for field numbers, type predicates, map helpers, entity ID detection. |
| base/src/test/kotlin/io/spine/code/proto/DescriptorSetReferenceFileSpec.kt | Extends coverage for creating desc.ref pointing at a descriptor set. |
| base/src/test/kotlin/io/spine/base/FieldNestingSpec.kt | Adds coverage for Field.nested(...) behavior. |
| base/src/test/kotlin/io/spine/base/ErrorsWithMessageSpec.kt | Adds coverage for Errors.fromThrowable ErrorWithMessage branch. |
| base/src/test/java/io/spine/type/MessageClassTest.java | Extends coverage for MessageClass.typeUrl() and equality behavior. |
| base/src/test/java/io/spine/code/proto/TypeSetTest.kt | Extends coverage for TypeSet bulk add, equality, and toString(). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #935 +/- ##
==========================================
+ Coverage 87.15% 94.06% +6.91%
==========================================
Files 193 193
Lines 4164 4164
Branches 339 339
==========================================
+ Hits 3629 3917 +288
+ Misses 412 147 -265
+ Partials 123 100 -23 🚀 New features to boost your workflow:
|
Contributor
Author
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Please see my comments.
Contributor
Author
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Please see my comments.
Replace the Java `MessageClassTest` with a Kotlin `MessageClassSpec` following the house test conventions (internal `Spec` class, backticked test names, Kotest assertions). All seven cases are preserved — equality, serialization round-trip, type name, super-interface discovery, type URL, and the two inequality cases. The `interfacesOf` test now uses a minimal abstract stub implementing the interface hierarchy (the method reflects only on directly-declared interfaces), removing the hand-rolled ~30-method `Message` stub. The test `MessageClass` subclass is a top-level private class, avoiding the outer-instance capture that the Java version had to suppress for the serialization test. Addresses review feedback asking for backticked function names. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
armiol
approved these changes
Jun 7, 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.
What
Raises line coverage of the
:basemodule from 89.6% → ~96.5% by adding and extending KotlinSpectests.Scope
This PR is primarily test coverage, but its diff against
masteralso includes non-test build/release artifacts that were already committed on this branch before the test work:config— submodule pointer update.No
:baseproduction (src/main) code is modified — the coverage was achieved purely by exercising existing public/internal API from tests.What changed (tests)
New and extended JUnit 5 suites covering previously-untested paths:
query—Columns(immutable-list delegation),Distribution(AND/OR distributive law),Columns/RecordColumn/SortBy/IdParameter/SubjectParametervalue semantics,ComparisonOperatorsymbols,QueryPredicateemptiness/equality,EntityQueryBuildercustom-column criterion + transformer,IdCriterionvararg ids.code.proto—Linker(partial resolution,toString, validation-error wrapping),FileDescriptorSetReader,FileSet(parse/of/parseAsKnownFiles/union),TypeSet,FieldDeclaration,MessageType,PackageName/FieldName,SourceFile,DescriptorSetReferenceFile.create.type—KnownTypes(toString,readResolve),Jsonerror paths,TypeUrlparsing,EnumType,ServiceType,MessageClass,PubPreconditions,UnknownTypeException.io/string/protobuf/base—Resource/ResourceObject/ResourceDirectory,Delete,Files2,Glob,StringifierRegistry, built-in stringifier singletons,Durations2,Field.nested,Errors(ErrorWithMessagebranch).Also normalizes
@Nestedtest groups to the backticked-name layout, removing@DisplayNamefrom@Nested inner classes per thekotlin-jvm-testerhouse convention (one pre-existing file,FieldDescriptorProtoExtsSpec, included).Reviewer notes
EqualsTester; stubs, not mocks;Spec/Testsuffixes per convention.throw factory(...)lines (the post-athrowprobe is unreachable),inline/reifiedfunctions (inlined at call sites), IOExceptioncatchblocks, and guarded/dead code (e.g.KnownTypes.extendWithbehindInvocationGuard,Linker.addUnresolved)../gradlew buildPASS (incl. detekt),spine-code-review+kotlin-engineerAPPROVE.🤖 Generated with Claude Code
🙌 Edited by @alexander-yevsyukov