Skip to content

Add Kotlin snippets for six User Guide sections#5432

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

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

Conversation

@yalishevant

Copy link
Copy Markdown
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.

@marcphilipp marcphilipp left a comment

Copy link
Copy Markdown
Member

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.

Comment thread documentation/src/test/kotlin/example/kotlin/DynamicTestsDemo.kt
Comment thread documentation/modules/ROOT/pages/writing-tests/repeated-tests.adoc
- 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

testlens-app Bot commented Mar 7, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

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


Learn more about TestLens at testlens.app.

@yalishevant

Copy link
Copy Markdown
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
Copy Markdown
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
yalishevant added a commit to yalishevant/junit-framework that referenced this pull request Apr 8, 2026
Add tabbed Java/Kotlin code examples to ten documentation pages,
continuing the effort started in junit-team#5316 and junit-team#5432.

Pages updated (Writing Tests):
- Built-in Extensions (@tempdir, @autoclose, Locale/TimeZone, SystemProperty)
- Conditional Test Execution
- Display Names
- Annotations
- Timeouts
- Test Interfaces and Default Methods

Pages updated (Extensions):
- Parameter Resolution
- Keeping State in Extensions
- Test Lifecycle Callbacks
- Registering Extensions

Issue: junit-team#5266

Signed-off-by: Anton.Yalyshev <yalishev.ant@gmail.com>
yalishevant added a commit to yalishevant/junit-framework that referenced this pull request Apr 8, 2026
Add tabbed Java/Kotlin code examples to ten documentation pages,
continuing the effort started in junit-team#5316 and junit-team#5432.

Pages updated (Writing Tests):
- Built-in Extensions (@tempdir, @autoclose, Locale/TimeZone, SystemProperty)
- Conditional Test Execution
- Display Names
- Annotations
- Timeouts
- Test Interfaces and Default Methods

Pages updated (Extensions):
- Parameter Resolution
- Keeping State in Extensions
- Test Lifecycle Callbacks
- Registering Extensions

Issue: junit-team#5266

Signed-off-by: Anton.Yalyshev <yalishev.ant@gmail.com>
yalishevant added a commit to yalishevant/junit-framework that referenced this pull request Apr 9, 2026
Add tabbed Java/Kotlin code examples to ten documentation pages,
continuing the effort started in junit-team#5316 and junit-team#5432.

Pages updated (Writing Tests):
- Built-in Extensions (@tempdir, @autoclose, Locale/TimeZone, SystemProperty)
- Conditional Test Execution
- Display Names
- Annotations
- Timeouts
- Test Interfaces and Default Methods

Pages updated (Extensions):
- Parameter Resolution
- Keeping State in Extensions
- Test Lifecycle Callbacks
- Registering Extensions

Signed-off-by: Anton.Yalyshev <yalishev.ant@gmail.com>
marcphilipp added a commit that referenced this pull request Apr 23, 2026
Add tabbed Java/Kotlin code examples to ten documentation pages,
continuing the effort started in #5316 and #5432.

Pages updated (Writing Tests):
- Built-in Extensions (@tempdir, @autoclose, Locale/TimeZone, SystemProperty)
- Conditional Test Execution
- Display Names
- Annotations
- Timeouts
- Test Interfaces and Default Methods

Pages updated (Extensions):
- Parameter Resolution
- Keeping State in Extensions
- Test Lifecycle Callbacks
- Registering Extensions

---------

Signed-off-by: Anton.Yalyshev <yalishev.ant@gmail.com>
Co-authored-by: Marc Philipp <mail@marcphilipp.de>
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