Skip to content

Commit 2ae6e6a

Browse files
Nils Breuneseodrotbohm
authored andcommitted
GH-814 - Fix and improve Kotlin code examples in reference documentation.
1 parent 609c39f commit 2ae6e6a

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

src/docs/antora/modules/ROOT/pages/documentation.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Kotlin::
3939
[source, kotlin, role="secondary"]
4040
----
4141
class DocumentationTests {
42-
private val modules = ApplicationModules.of(Application::class)
42+
private val modules = ApplicationModules.of(Application::class.java)
4343
4444
@Test
4545
fun writeDocumentationSnippets() {
@@ -240,7 +240,7 @@ Kotlin::
240240
----
241241
class DocumentationTests {
242242
243-
private val modules = ApplicationModules.of(Application::class)
243+
private val modules = ApplicationModules.of(Application::class.java)
244244
245245
@Test
246246
fun writeDocumentationSnippets() {
@@ -336,7 +336,7 @@ Kotlin::
336336
----
337337
class DocumentationTests {
338338
339-
private val modules = ApplicationModules.of(Application::class)
339+
private val modules = ApplicationModules.of(Application::class.java)
340340
341341
@Test
342342
fun writeDocumentationSnippets() {

src/docs/antora/modules/ROOT/pages/events.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class ExternalizationConfiguration {
451451

452452
return EventExternalizationConfiguration.externalizing() // <1>
453453
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
454-
.mapping(SomeEvent.class, it -> …) // <3>
454+
.mapping(SomeEvent.class, event -> …) // <3>
455455
.routeKey(WithKeyProperty.class, WithKeyProperty::getKey) // <4>
456456
.build();
457457
}
@@ -469,8 +469,8 @@ class ExternalizationConfiguration {
469469

470470
EventExternalizationConfiguration.externalizing() // <1>
471471
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
472-
.mapping(SomeEvent::class, it -> …) // <3>
473-
.routeKey(WithKeyProperty::class, WithKeyProperty::getKey) // <4>
472+
.mapping(SomeEvent::class.java) { event -> … } // <3>
473+
.routeKey(WithKeyProperty::class.java, WithKeyProperty::getKey) // <4>
474474
.build()
475475
}
476476
}
@@ -527,7 +527,7 @@ class OrderIntegrationTests {
527527
fun someTestMethod(events: PublishedEvents events) {
528528

529529
// …
530-
var matchingMapped = events.ofType(OrderCompleted::class)
530+
val matchingMapped = events.ofType(OrderCompleted::class.java)
531531
.matching(OrderCompleted::getOrderId, reference.getId())
532532

533533
assertThat(matchingMapped).hasSize(1)
@@ -572,7 +572,7 @@ class OrderIntegrationTests {
572572

573573
// …
574574
assertThat(events)
575-
.contains(OrderCompleted::class)
575+
.contains(OrderCompleted::class.java)
576576
.matching(OrderCompleted::getOrderId, reference.getId())
577577
}
578578
}

src/docs/antora/modules/ROOT/pages/fundamentals.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Kotlin::
3838
+
3939
[source, kotlin, role="secondary"]
4040
----
41-
var modules = ApplicationModules.of(Application::class)
41+
val modules = ApplicationModules.of(Application::class.java)
4242
----
4343
======
4444
The `modules` will contain an in-memory representation of the application module arrangement derived from the codebase.
@@ -101,7 +101,7 @@ Kotlin::
101101
+
102102
[source, kotlin, role="secondary"]
103103
----
104-
ApplicationModules.of(Application::class, JavaClass.Predicates.resideInAPackage("com.example.db")).verify()
104+
ApplicationModules.of(Application::class.java, JavaClass.Predicates.resideInAPackage("com.example.db")).verify()
105105
----
106106
======
107107

src/docs/antora/modules/ROOT/pages/testing.adoc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Kotlin::
179179
scenario.publish(MyApplicationEvent(…)).…
180180
181181
// Start with a bean invocation
182-
scenario.stimulate(() -> someBean.someMethod(…)).…
182+
scenario.stimulate(Runnable { someBean.someMethod(…) }).…
183183
----
184184
======
185185

@@ -263,9 +263,9 @@ Kotlin::
263263
[source, kotlin, role="secondary"]
264264
----
265265
scenario.publish(new MyApplicationEvent(…))
266-
.andWaitForEventOfType(SomeOtherEvent::class)
267-
.matching(event -> …)
268-
.toArriveAndVerify(event -> …)
266+
.andWaitForEventOfType(SomeOtherEvent::class.java)
267+
.matching { event -> … }
268+
.toArriveAndVerify { event -> … }
269269
----
270270
======
271271

@@ -287,9 +287,9 @@ Kotlin::
287287
+
288288
[source, kotlin, role="secondary"]
289289
----
290-
scenario.publish(new MyApplicationEvent(…))
291-
.andWaitForStateChange(() -> someBean.someMethod(…)))
292-
.andVerify(result -> …)
290+
scenario.publish(MyApplicationEvent(…))
291+
.andWaitForStateChange { someBean.someMethod(…) }
292+
.andVerify { result -> … }
293293
----
294294
======
295295

@@ -310,7 +310,7 @@ Java::
310310
[source, java, subs="+quotes", role="primary"]
311311
----
312312
scenario.publish(new MyApplicationEvent(…))
313-
**.customize(it -> it.atMost(Duration.ofSeconds(2)))**
313+
**.customize(conditionFactory -> conditionFactory.atMost(Duration.ofSeconds(2)))**
314314
.andWaitForEventOfType(SomeOtherEvent.class)
315315
.matching(event -> …)
316316
.toArriveAndVerify(event -> …);
@@ -320,10 +320,10 @@ Kotlin::
320320
[source, kotlin, subs="+quotes", role="secondary"]
321321
----
322322
scenario.publish(MyApplicationEvent(…))
323-
**.customize(it -> it.atMost(Duration.ofSeconds(2)))**
324-
.andWaitForEventOfType(SomeOtherEvent::class)
325-
.matching(event -> …)
326-
.toArriveAndVerify(event -> …)
323+
**.customize { it.atMost(Duration.ofSeconds(2)) }**
324+
.andWaitForEventOfType(SomeOtherEvent::class.java)
325+
.matching { event -> … }
326+
.toArriveAndVerify { event -> … }
327327
----
328328
======
329329

@@ -348,7 +348,7 @@ class MyTests {
348348
349349
@Override
350350
Function<ConditionFactory, ConditionFactory> getDefaultCustomizer(Method method, ApplicationContext context) {
351-
return it -> …;
351+
return conditionFactory -> …;
352352
}
353353
}
354354
}
@@ -361,14 +361,14 @@ Kotlin::
361361
class MyTests {
362362
363363
@Test
364-
fun myTestCase(scenario : Scenario) {
364+
fun myTestCase(scenario: Scenario) {
365365
// scenario will be pre-customized with logic defined in MyCustomizer
366366
}
367367
368368
class MyCustomizer : ScenarioCustomizer {
369369
370-
override fun getDefaultCustomizer(method : Method, context : ApplicationContext) : Function<ConditionFactory, ConditionFactory> {
371-
return it -> …
370+
override fun getDefaultCustomizer(method: Method, context: ApplicationContext): UnaryOperator<ConditionFactory> {
371+
return UnaryOperator { conditionFactory -> … }
372372
}
373373
}
374374
}

src/docs/antora/modules/ROOT/pages/verification.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Kotlin::
1616
+
1717
[source, kotlin, role="secondary"]
1818
----
19-
ApplicationModules.of(Application::class).verify()
19+
ApplicationModules.of(Application::class.java).verify()
2020
----
2121
======
2222
The verification includes the following rules:

0 commit comments

Comments
 (0)