Skip to content

Add Kotlin snippets for six User Guide sections#5432

Merged
marcphilipp merged 1 commit intojunit-team:mainfrom
yalishevant:kotlin-snippets-batch2
Mar 9, 2026
Merged

Add Kotlin snippets for six User Guide sections#5432
marcphilipp merged 1 commit intojunit-team:mainfrom
yalishevant:kotlin-snippets-batch2

Conversation

@yalishevant
Copy link
Contributor

Adds Kotlin tabbed code snippets to six more User Guide sections,
continuing the effort started in #5316.

Pages updated:

  • Nested Tests
  • Dynamic Tests
  • Assumptions
  • Exception Handling
  • Repeated Tests
  • Test Classes and Methods

Each Java code block is wrapped in [tabs] with a corresponding
Kotlin example that mirrors the same test logic using idiomatic
Kotlin: property access, string templates, reified generics,
trailing lambdas, companion object + @JvmStatic for lifecycle
methods, etc.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

  • There are no TODOs left in the code
  • Method preconditions are checked (N/A — documentation only)
  • Coding conventions have been followed
  • Change is covered by automated tests
  • Public API has Javadoc and @API annotations (N/A — documentation only)
  • Change is documented in the User Guide

@testlens-app

This comment has been minimized.

Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! I left a few comments/questions inline.

- Add Kotlin examples for Nested Tests documentation
- Add Kotlin examples for Dynamic Tests documentation
- Add Kotlin examples for Assumptions documentation
- Add Kotlin examples for Exception Handling documentation
- Add Kotlin examples for Repeated Tests documentation
- Add Kotlin examples for Test Classes and Methods documentation
- Wrap existing Java code blocks in tabbed snippets (Java/Kotlin)

---------

Signed-off-by: Anton.Yalyshev <yalishev.ant@gmail.com>
@yalishevant yalishevant force-pushed the kotlin-snippets-batch2 branch from 2ef4afc to da2d5bd Compare March 7, 2026 11:37
@testlens-app
Copy link

testlens-app bot commented Mar 7, 2026

✅ All tests passed ✅

🏷️ Commit: da2d5bd
▶️ Tests: 5539 executed
⚪️ Checks: 15/15 completed


Learn more about TestLens at testlens.app.

@yalishevant
Copy link
Contributor Author

Thanks for the review! I've addressed all the comments:

  • Added a Sequence example in DynamicTestsDemo.kt
  • Wrapped the inline snippet in repeated-tests.adoc in tabs
  • Rebased onto latest main and updated ExceptionAssertionExactDemo.kt to use the new reified assertThrowsExactly from Introduce Kotlin variant of assertThrowsExactly #5436
  • Replied to the lateinit question in the thread

By the way - was six pages a reasonable scope for one PR, or would you prefer smaller/larger batches going forward?

@yalishevant yalishevant requested a review from marcphilipp March 9, 2026 11:55
@marcphilipp
Copy link
Member

By the way - was six pages a reasonable scope for one PR, or would you prefer smaller/larger batches going forward?

I think that's a good size. If you'd prefer slightly larger to reduce the time you have to wait for my reviews, I'd be fine with that, though.

@marcphilipp marcphilipp merged commit a1009c2 into junit-team:main Mar 9, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants