From 7c65b57530b77999b66e9d8dad1db235cc3e0934 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 17 Feb 2019 17:22:04 +0100 Subject: [PATCH] Polish Kotlin chapter --- src/docs/asciidoc/languages/kotlin.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/docs/asciidoc/languages/kotlin.adoc b/src/docs/asciidoc/languages/kotlin.adoc index a74519b8ad..aea6ad7754 100644 --- a/src/docs/asciidoc/languages/kotlin.adoc +++ b/src/docs/asciidoc/languages/kotlin.adoc @@ -597,7 +597,7 @@ is https://junit.org/junit5/[JUnit 5], as well as https://mockk.io/[Mockk] for m ==== Constructor injection As described in the <>, JUnit 5 allows -constructor injection of beans which is pretty useful with Kotlin in order to use `val` instead of `lateinit var `. +constructor injection of beans which is pretty useful with Kotlin in order to use `val` instead of `lateinit var`. ==== @@ -619,8 +619,8 @@ You can also use `@Autowired` at constructor level to autowire all parameters. ---- @SpringJUnitConfig(TestConfig::class) class OrderServiceIntegrationTests @Autowired constructor( - val orderService: OrderService, - val customerService: CustomerService) { + val orderService: OrderService, + val customerService: CustomerService) { // tests that use the injected OrderService and CustomerService } @@ -630,16 +630,16 @@ class OrderServiceIntegrationTests @Autowired constructor( ==== `PER_CLASS` Lifecycle -Kotlin lets you specify meaningful test function names between backticks (\`). +Kotlin lets you specify meaningful test function names between backticks (```). As of JUnit 5, Kotlin test classes can use the `@TestInstance(TestInstance.Lifecycle.PER_CLASS)` annotation to enable a single instantiation of test classes, which allows the use of `@BeforeAll` and `@AfterAll` annotations on non-static methods, which is a good fit for Kotlin. -You can now change the default behavior to `PER_CLASS` thanks to a +You can also change the default behavior to `PER_CLASS` thanks to a `junit-platform.properties` file with a `junit.jupiter.testinstance.lifecycle.default = per_class` property. -The following example `@BeforeAll` and `@AfterAll` annotations on non-static methods: +The following example demonstrates `@BeforeAll` and `@AfterAll` annotations on non-static methods: ==== [source] -- GitLab