Fix migration to asciidoctor tabs
The automation to asciidoctor tabs did not migrate properly for all cases this commit fixes the migration. See gh-30435
This commit is contained in:
@@ -54,14 +54,13 @@ Java::
|
||||
}
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Annotate the test class with `@RecordApplicationEvents`.
|
||||
<2> Inject the `ApplicationEvents` instance for the current test.
|
||||
<3> Use the `ApplicationEvents` API to count how many `OrderSubmitted` events were published.
|
||||
|
||||
// Don't use "quotes" in the "subs" section because of the asterisks in /* ... */
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig(/* ... */)
|
||||
@RecordApplicationEvents // <1>
|
||||
@@ -86,6 +85,7 @@ Java::
|
||||
<1> Annotate the test class with `@RecordApplicationEvents`.
|
||||
<2> Inject the `ApplicationEvents` instance for the current test.
|
||||
<3> Use the `ApplicationEvents` API to count how many `OrderSubmitted` events were published.
|
||||
======
|
||||
|
||||
See the
|
||||
{api-spring-framework}/test/context/event/ApplicationEvents.html[`ApplicationEvents`
|
||||
|
||||
@@ -31,11 +31,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Injecting the `ApplicationContext`.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig
|
||||
class MyTest {
|
||||
@@ -47,6 +47,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Injecting the `ApplicationContext`.
|
||||
======
|
||||
|
||||
|
||||
Similarly, if your test is configured to load a `WebApplicationContext`, you can inject
|
||||
@@ -67,12 +68,12 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Configuring the `WebApplicationContext`.
|
||||
<2> Injecting the `WebApplicationContext`.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitWebConfig // <1>
|
||||
class MyWebAppTest {
|
||||
@@ -84,6 +85,7 @@ Java::
|
||||
----
|
||||
<1> Configuring the `WebApplicationContext`.
|
||||
<2> Injecting the `WebApplicationContext`.
|
||||
======
|
||||
|
||||
|
||||
Dependency injection by using `@Autowired` is provided by the
|
||||
|
||||
@@ -28,11 +28,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying the location of Groovy configuration files.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from "/AppConfig.groovy" and
|
||||
@@ -43,6 +43,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying the location of Groovy configuration files.
|
||||
======
|
||||
|
||||
|
||||
If you omit both the `locations` and `value` attributes from the `@ContextConfiguration`
|
||||
@@ -67,11 +68,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Loading configuration from the default location.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from
|
||||
@@ -82,6 +83,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Loading configuration from the default location.
|
||||
======
|
||||
|
||||
|
||||
.Declaring XML configuration and Groovy scripts simultaneously
|
||||
|
||||
@@ -47,12 +47,12 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Configuration file defined in the superclass.
|
||||
<2> Configuration file defined in the subclass.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from "/base-config.xml"
|
||||
@@ -71,6 +71,7 @@ Java::
|
||||
----
|
||||
<1> Configuration file defined in the superclass.
|
||||
<2> Configuration file defined in the subclass.
|
||||
======
|
||||
|
||||
|
||||
Similarly, in the next example, which uses component classes, the `ApplicationContext`
|
||||
@@ -97,12 +98,12 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Configuration class defined in the superclass.
|
||||
<2> Configuration class defined in the subclass.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
// ApplicationContext will be loaded from BaseConfig
|
||||
@SpringJUnitConfig(BaseConfig::class) // <1>
|
||||
@@ -118,6 +119,7 @@ Java::
|
||||
----
|
||||
<1> Configuration class defined in the superclass.
|
||||
<2> Configuration class defined in the subclass.
|
||||
======
|
||||
|
||||
|
||||
In the next example, which uses context initializers, the `ApplicationContext` for
|
||||
@@ -146,12 +148,12 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Initializer defined in the superclass.
|
||||
<2> Initializer defined in the subclass.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
// ApplicationContext will be initialized by BaseInitializer
|
||||
@SpringJUnitConfig(initializers = [BaseInitializer::class]) // <1>
|
||||
@@ -168,5 +170,6 @@ Java::
|
||||
----
|
||||
<1> Initializer defined in the superclass.
|
||||
<2> Initializer defined in the subclass.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying configuration by using a configuration class and an initializer.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from TestConfig
|
||||
@@ -46,6 +46,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying configuration by using a configuration class and an initializer.
|
||||
======
|
||||
|
||||
|
||||
You can also omit the declaration of XML configuration files, Groovy scripts, or
|
||||
@@ -68,11 +69,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying configuration by using only an initializer.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be initialized by EntireAppInitializer
|
||||
@@ -83,5 +84,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying configuration by using only an initializer.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying component classes.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from AppConfig and TestConfig
|
||||
@@ -33,6 +33,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying component classes.
|
||||
======
|
||||
|
||||
|
||||
[[testcontext-ctx-management-javaconfig-component-classes]]
|
||||
@@ -100,11 +101,11 @@ Java::
|
||||
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Loading configuration information from the nested `Config` class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig <1>
|
||||
// ApplicationContext will be loaded from the nested Config class
|
||||
@@ -131,5 +132,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Loading configuration information from the nested `Config` class.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying a properties file with an absolute path.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@TestPropertySource("/test.properties") // <1>
|
||||
@@ -65,6 +65,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying a properties file with an absolute path.
|
||||
======
|
||||
|
||||
|
||||
You can configure inlined properties in the form of key-value pairs by using the
|
||||
@@ -93,11 +94,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Setting two properties by using two variations of the key-value syntax.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@TestPropertySource(properties = ["timezone = GMT", "port: 4242"]) // <1>
|
||||
@@ -106,6 +107,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Setting two properties by using two variations of the key-value syntax.
|
||||
======
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
|
||||
@@ -24,11 +24,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Setting the locations attribute to a list of XML files.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from "/app-config.xml" and
|
||||
@@ -39,6 +39,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Setting the locations attribute to a list of XML files.
|
||||
======
|
||||
|
||||
|
||||
`@ContextConfiguration` supports an alias for the `locations` attribute through the
|
||||
@@ -59,11 +60,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying XML files without using the `locations` attribute.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
@ContextConfiguration("/app-config.xml", "/test-config.xml") // <1>
|
||||
@@ -72,6 +73,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying XML files without using the `locations` attribute.
|
||||
======
|
||||
|
||||
|
||||
If you omit both the `locations` and the `value` attributes from the
|
||||
@@ -96,11 +98,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Loading configuration from the default location.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ExtendWith(SpringExtension::class)
|
||||
// ApplicationContext will be loaded from
|
||||
@@ -111,5 +113,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Loading configuration from the default location.
|
||||
======
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user