Skip to content

Add exhaustive tests for JsonValue and JsonKey usage in value class #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 15, 2025

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Jun 15, 2025

SSIA

@k163377 k163377 requested a review from Copilot June 15, 2025 02:15
@k163377 k163377 marked this pull request as ready for review June 15, 2025 02:15
Copy link

@Copilot 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 PR adds comprehensive tests for serialization behavior of Kotlin inline value classes using Jackson’s @JsonValue and @JsonKey annotations.

  • Introduces JsonValue tests for various primitive and object inline classes, covering direct and property-wrapped serialization, including nullability.
  • Introduces JsonKey tests for map key serialization using inline classes, covering primitive and object types, including null handling.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/kotlin/.../jsonValue/TwoUnitPrimitiveTest.kt Tests @JsonValue on two-unit Long value classes
src/test/kotlin/.../jsonValue/PrimitiveTest.kt Tests @JsonValue on single-unit Int value classes
src/test/kotlin/.../jsonValue/NullablePrimitiveTest.kt Tests @JsonValue on nullable Int value classes
src/test/kotlin/.../jsonValue/NullableObjectTest.kt Tests @JsonValue on nullable String value classes
src/test/kotlin/.../jsonValue/NonNullObjectTest.kt Tests @JsonValue on non-null String value classes
src/test/kotlin/.../jsonKey/TwoUnitPrimitiveTest.kt Tests @JsonKey on two-unit Long keys in maps
src/test/kotlin/.../jsonKey/PrimitiveTest.kt Tests @JsonKey on single-unit Int keys in maps
src/test/kotlin/.../jsonKey/NullablePrimitiveTest.kt Tests @JsonKey on nullable Int keys in maps
src/test/kotlin/.../jsonKey/NullableObjectTest.kt Tests @JsonKey on nullable String keys in maps
src/test/kotlin/.../jsonKey/NonNullObjectTest.kt Tests @JsonKey on non-null String keys in maps
Comments suppressed due to low confidence (3)

src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/ser/valueClass/jsonKey/NullablePrimitiveTest.kt:17

  • [nitpick] The test method name test is too generic; consider renaming it to reflect its scenario, e.g., nullablePrimitiveKeySerializesCorrectly.
fun test() {

src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/ser/valueClass/jsonKey/NullableObjectTest.kt:17

  • [nitpick] Consider renaming this test method to something more descriptive (e.g., nullableObjectKeyModifiedValue) for better clarity.
fun test() {

src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration/ser/valueClass/jsonKey/PrimitiveTest.kt:29

  • Consider adding a test that asserts the expected exception when @JsonKey returns null, ensuring the library surfaces the error as intended.
// The case of returning null as a key is unnecessary because it will result in an error

@k163377 k163377 merged commit 54a7bc9 into develop Jun 15, 2025
2 checks passed
@k163377 k163377 deleted the json-value-json-key-test branch June 15, 2025 02:22
k163377 added a commit to k163377/jackson-module-kotlin that referenced this pull request Jun 15, 2025
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.

1 participant