GH-815 - Fix and improve Kotlin code examples in reference documentation.
This commit is contained in:
committed by
Oliver Drotbohm
parent
354a4c6e0c
commit
13d7618798
@@ -37,7 +37,7 @@ Kotlin::
|
||||
[source, kotlin, role="secondary"]
|
||||
----
|
||||
class DocumentationTests {
|
||||
private val modules = ApplicationModules.of(Application::class)
|
||||
private val modules = ApplicationModules.of(Application::class.java)
|
||||
|
||||
@Test
|
||||
fun writeDocumentationSnippets() {
|
||||
@@ -238,7 +238,7 @@ Kotlin::
|
||||
----
|
||||
class DocumentationTests {
|
||||
|
||||
private val modules = ApplicationModules.of(Application::class)
|
||||
private val modules = ApplicationModules.of(Application::class.java)
|
||||
|
||||
@Test
|
||||
fun writeDocumentationSnippets() {
|
||||
|
||||
@@ -425,7 +425,7 @@ class ExternalizationConfiguration {
|
||||
|
||||
return EventExternalizationConfiguration.externalizing() // <1>
|
||||
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
|
||||
.mapping(SomeEvent.class, it -> …) // <3>
|
||||
.mapping(SomeEvent.class, event -> …) // <3>
|
||||
.routeKey(WithKeyProperty.class, WithKeyProperty::getKey) // <4>
|
||||
.build();
|
||||
}
|
||||
@@ -443,8 +443,8 @@ class ExternalizationConfiguration {
|
||||
|
||||
EventExternalizationConfiguration.externalizing() // <1>
|
||||
.select(EventExternalizationConfiguration.annotatedAsExternalized()) // <2>
|
||||
.mapping(SomeEvent::class, it -> …) // <3>
|
||||
.routeKey(WithKeyProperty::class, WithKeyProperty::getKey) // <4>
|
||||
.mapping(SomeEvent::class.java) { event -> … } // <3>
|
||||
.routeKey(WithKeyProperty::class.java, WithKeyProperty::getKey) // <4>
|
||||
.build()
|
||||
}
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class OrderIntegrationTests {
|
||||
fun someTestMethod(events: PublishedEvents events) {
|
||||
|
||||
// …
|
||||
var matchingMapped = events.ofType(OrderCompleted::class)
|
||||
val matchingMapped = events.ofType(OrderCompleted::class.java)
|
||||
.matching(OrderCompleted::getOrderId, reference.getId())
|
||||
|
||||
assertThat(matchingMapped).hasSize(1)
|
||||
@@ -546,7 +546,7 @@ class OrderIntegrationTests {
|
||||
|
||||
// …
|
||||
assertThat(events)
|
||||
.contains(OrderCompleted::class)
|
||||
.contains(OrderCompleted::class.java)
|
||||
.matching(OrderCompleted::getOrderId, reference.getId())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ Kotlin::
|
||||
+
|
||||
[source, kotlin, role="secondary"]
|
||||
----
|
||||
var modules = ApplicationModules.of(Application::class)
|
||||
var modules = ApplicationModules.of(Application::class.java)
|
||||
----
|
||||
======
|
||||
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:
|
||||
|
||||
@@ -179,7 +179,7 @@ Kotlin::
|
||||
scenario.publish(MyApplicationEvent(…)).…
|
||||
|
||||
// Start with a bean invocation
|
||||
scenario.stimulate(() -> someBean.someMethod(…)).…
|
||||
scenario.stimulate(Runnable { someBean.someMethod(…) }).…
|
||||
----
|
||||
======
|
||||
|
||||
@@ -263,9 +263,9 @@ Kotlin::
|
||||
[source, kotlin, role="secondary"]
|
||||
----
|
||||
scenario.publish(new MyApplicationEvent(…))
|
||||
.andWaitForEventOfType(SomeOtherEvent::class)
|
||||
.matching(event -> …)
|
||||
.toArriveAndVerify(event -> …)
|
||||
.andWaitForEventOfType(SomeOtherEvent::class.java)
|
||||
.matching { event -> … }
|
||||
.toArriveAndVerify { event -> … }
|
||||
----
|
||||
======
|
||||
|
||||
@@ -287,9 +287,9 @@ Kotlin::
|
||||
+
|
||||
[source, kotlin, role="secondary"]
|
||||
----
|
||||
scenario.publish(new MyApplicationEvent(…))
|
||||
.andWaitForStateChange(() -> someBean.someMethod(…)))
|
||||
.andVerify(result -> …)
|
||||
scenario.publish(MyApplicationEvent(…))
|
||||
.andWaitForStateChange { someBean.someMethod(…) }
|
||||
.andVerify { result -> … }
|
||||
----
|
||||
======
|
||||
|
||||
@@ -310,7 +310,7 @@ Java::
|
||||
[source, java, subs="+quotes", role="primary"]
|
||||
----
|
||||
scenario.publish(new MyApplicationEvent(…))
|
||||
**.customize(it -> it.atMost(Duration.ofSeconds(2)))**
|
||||
**.customize(conditionFactory -> conditionFactory.atMost(Duration.ofSeconds(2)))**
|
||||
.andWaitForEventOfType(SomeOtherEvent.class)
|
||||
.matching(event -> …)
|
||||
.toArriveAndVerify(event -> …);
|
||||
@@ -320,10 +320,10 @@ Kotlin::
|
||||
[source, kotlin, subs="+quotes", role="secondary"]
|
||||
----
|
||||
scenario.publish(MyApplicationEvent(…))
|
||||
**.customize(it -> it.atMost(Duration.ofSeconds(2)))**
|
||||
.andWaitForEventOfType(SomeOtherEvent::class)
|
||||
.matching(event -> …)
|
||||
.toArriveAndVerify(event -> …)
|
||||
**.customize { it.atMost(Duration.ofSeconds(2)) }**
|
||||
.andWaitForEventOfType(SomeOtherEvent::class.java)
|
||||
.matching { event -> … }
|
||||
.toArriveAndVerify { event -> … }
|
||||
----
|
||||
======
|
||||
|
||||
@@ -348,7 +348,7 @@ class MyTests {
|
||||
|
||||
@Override
|
||||
Function<ConditionFactory, ConditionFactory> getDefaultCustomizer(Method method, ApplicationContext context) {
|
||||
return it -> …;
|
||||
return conditionFactory -> …;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -361,14 +361,14 @@ Kotlin::
|
||||
class MyTests {
|
||||
|
||||
@Test
|
||||
fun myTestCase(scenario : Scenario) {
|
||||
fun myTestCase(scenario: Scenario) {
|
||||
// scenario will be pre-customized with logic defined in MyCustomizer
|
||||
}
|
||||
|
||||
class MyCustomizer : ScenarioCustomizer {
|
||||
|
||||
override fun getDefaultCustomizer(method : Method, context : ApplicationContext) : Function<ConditionFactory, ConditionFactory> {
|
||||
return it -> …
|
||||
override fun getDefaultCustomizer(method: Method, context: ApplicationContext): UnaryOperator<ConditionFactory> {
|
||||
return UnaryOperator { conditionFactory -> … }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ Kotlin::
|
||||
+
|
||||
[source, kotlin, role="secondary"]
|
||||
----
|
||||
ApplicationModules.of(Application::class).verify()
|
||||
ApplicationModules.of(Application::class.java).verify()
|
||||
----
|
||||
======
|
||||
The verification includes the following rules:
|
||||
|
||||
Reference in New Issue
Block a user