Skip to content

Raise base test coverage#935

Merged
alexander-yevsyukov merged 5 commits into
masterfrom
raise-coverage-more
Jun 7, 2026
Merged

Raise base test coverage#935
alexander-yevsyukov merged 5 commits into
masterfrom
raise-coverage-more

Conversation

@alexander-yevsyukov
Copy link
Copy Markdown
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Jun 6, 2026

What

Raises line coverage of the :base module from 89.6% → ~96.5% by adding and extending Kotlin Spec tests.

Scope

This PR is primarily test coverage, but its diff against master also includes non-test build/release artifacts that were already committed on this branch before the test work:

  • config — submodule pointer update.

No :base production (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:

  • queryColumns (immutable-list delegation), Distribution (AND/OR distributive law), Columns/RecordColumn/SortBy/IdParameter/SubjectParameter value semantics, ComparisonOperator symbols, QueryPredicate emptiness/equality, EntityQueryBuilder custom-column criterion + transformer, IdCriterion vararg ids.
  • code.protoLinker (partial resolution, toString, validation-error wrapping), FileDescriptorSetReader, FileSet (parse/of/parseAsKnownFiles/union), TypeSet, FieldDeclaration, MessageType, PackageName/FieldName, SourceFile, DescriptorSetReferenceFile.create.
  • typeKnownTypes (toString, readResolve), Json error paths, TypeUrl parsing, EnumType, ServiceType, MessageClass, PubPreconditions, UnknownTypeException.
  • io / string / protobuf / baseResource/ResourceObject/ResourceDirectory, Delete, Files2, Glob, StringifierRegistry, built-in stringifier singletons, Durations2, Field.nested, Errors (ErrorWithMessage branch).

Also normalizes @Nested test groups to the backticked-name layout, removing @DisplayName from @Nested inner classes per the kotlin-jvm-tester house convention (one pre-existing file, FieldDescriptorProtoExtsSpec, included).

Reviewer notes

  • All new tests are Kotlin with Kotest assertions and Guava EqualsTester; stubs, not mocks; Spec/Test suffixes per convention.
  • The remaining ~140 uncovered lines are non-actionable for JaCoCo/Kover: throw factory(...) lines (the post-athrow probe is unreachable), inline/reified functions (inlined at call sites), IOException catch blocks, and guarded/dead code (e.g. KnownTypes.extendWith behind InvocationGuard, Linker.addUnresolved).
  • Pre-PR gate run locally: ./gradlew build PASS (incl. detekt), spine-code-review + kotlin-engineer APPROVE.

🤖 Generated with Claude Code
🙌 Edited by @alexander-yevsyukov

alexander-yevsyukov and others added 4 commits June 6, 2026 18:16
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>
Copilot AI review requested due to automatic review settings June 6, 2026 21:22
@alexander-yevsyukov alexander-yevsyukov changed the title Raise base test coverage to ~96% Raise base test coverage Jun 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :base module tests covering type, query, code.proto, io, protobuf, string, and base utilities.
  • Bumped the published snapshot version from 2.0.0-SNAPSHOT.401 to 2.0.0-SNAPSHOT.402 and refreshed generated dependency documentation.
  • Added buildSrc logic to collect/merge TestKit worker JaCoCo .exec data into Kover reports (skipped in review per buildSrc/** 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().

Comment thread version.gradle.kts
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.06%. Comparing base (5c5e777) to head (3257092).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor Author

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

Copy link
Copy Markdown
Contributor Author

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

Comment thread base/src/test/java/io/spine/type/MessageClassTest.java Outdated
Comment thread base/src/test/java/io/spine/type/MessageClassTest.java Outdated
Comment thread base/src/test/java/io/spine/type/MessageClassTest.java Outdated
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 36 changed files in this pull request and generated no new comments.

@alexander-yevsyukov alexander-yevsyukov merged commit 603f14f into master Jun 7, 2026
9 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the raise-coverage-more branch June 7, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants