Skip to content

Commit 13d7618

Browse files
Nils Breuneseodrotbohm
authored andcommitted
GH-815 - Fix and improve Kotlin code examples in reference documentation.
1 parent 354a4c6 commit 13d7618

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Kotlin::
3737
[source, kotlin, role="secondary"]
3838
----
3939
class DocumentationTests {
40-
private val modules = ApplicationModules.of(Application::class)
40+
private val modules = ApplicationModules.of(Application::class.java)
4141
4242
@Test
4343
fun writeDocumentationSnippets() {
@@ -238,7 +238,7 @@ Kotlin::
238238
----
239239
class DocumentationTests {
240240
241-
private val modules = ApplicationModules.of(Application::class)
241+
private val modules = ApplicationModules.of(Application::class.java)
242242
243243
@Test
244244
fun writeDocumentationSnippets() {

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

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

426426
return EventExternalizationConfiguration.externalizing() // <1>
427427
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
428-
.mapping(SomeEvent.class, it -> …) // <3>
428+
.mapping(SomeEvent.class, event -> …) // <3>
429429
.routeKey(WithKeyProperty.class, WithKeyProperty::getKey) // <4>
430430
.build();
431431
}
@@ -443,8 +443,8 @@ class ExternalizationConfiguration {
443443

444444
EventExternalizationConfiguration.externalizing() // <1>
445445
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
446-
.mapping(SomeEvent::class, it -> …) // <3>
447-
.routeKey(WithKeyProperty::class, WithKeyProperty::getKey) // <4>
446+
.mapping(SomeEvent::class.java) { event -> … } // <3>
447+
.routeKey(WithKeyProperty::class.java, WithKeyProperty::getKey) // <4>
448448
.build()
449449
}
450450
}
@@ -501,7 +501,7 @@ class OrderIntegrationTests {
501501
fun someTestMethod(events: PublishedEvents events) {
502502

503503
// …
504-
var matchingMapped = events.ofType(OrderCompleted::class)
504+
val matchingMapped = events.ofType(OrderCompleted::class.java)
505505
.matching(OrderCompleted::getOrderId, reference.getId())
506506

507507
assertThat(matchingMapped).hasSize(1)
@@ -546,7 +546,7 @@ class OrderIntegrationTests {
546546

547547
// …
548548
assertThat(events)
549-
.contains(OrderCompleted::class)
549+
.contains(OrderCompleted::class.java)
550550
.matching(OrderCompleted::getOrderId, reference.getId())
551551
}
552552
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Kotlin::
122122
+
123123
[source, kotlin, role="secondary"]
124124
----
125-
var modules = ApplicationModules.of(Application::class)
125+
var modules = ApplicationModules.of(Application::class.java)
126126
----
127127
======
128128
To get an impression of what the analyzed arrangement looks like, we can just write the individual modules contained in the overall model to the console:

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)