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:
@@ -36,11 +36,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specify the configuration class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig(TestConfig::class) // <1>
|
||||
class ConfigurationClassJUnitJupiterSpringTests {
|
||||
@@ -48,6 +48,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specify the configuration class.
|
||||
======
|
||||
|
||||
|
||||
The following example shows how to use the `@SpringJUnitConfig` annotation to specify the
|
||||
@@ -64,11 +65,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specify the location of a configuration file.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig(locations = ["/test-config.xml"]) // <1>
|
||||
class XmlJUnitJupiterSpringTests {
|
||||
@@ -76,6 +77,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specify the location of a configuration file.
|
||||
======
|
||||
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management.adoc[Context Management] as well as the javadoc for
|
||||
@@ -109,11 +111,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specify the configuration class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitWebConfig(TestConfig::class) // <1>
|
||||
class ConfigurationClassJUnitJupiterSpringWebTests {
|
||||
@@ -121,6 +123,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specify the configuration class.
|
||||
======
|
||||
|
||||
|
||||
The following example shows how to use the `@SpringJUnitWebConfig` annotation to specify the
|
||||
@@ -137,11 +140,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specify the location of a configuration file.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitWebConfig(locations = ["/test-config.xml"]) // <1>
|
||||
class XmlJUnitJupiterSpringWebTests {
|
||||
@@ -149,6 +152,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specify the location of a configuration file.
|
||||
======
|
||||
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management.adoc[Context Management] as well as the javadoc for
|
||||
|
||||
@@ -39,11 +39,11 @@ Java::
|
||||
// some logic that should run only on Java VMs from Oracle Corporation
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Run this test only when the Java vendor is "Oracle Corporation".
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@IfProfileValue(name="java.vendor", value="Oracle Corporation") // <1>
|
||||
@Test
|
||||
@@ -52,6 +52,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Run this test only when the Java vendor is "Oracle Corporation".
|
||||
======
|
||||
|
||||
|
||||
Alternatively, you can configure `@IfProfileValue` with a list of `values` (with `OR`
|
||||
@@ -70,11 +71,11 @@ Java::
|
||||
// some logic that should run only for unit and integration test groups
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Run this test for unit tests and integration tests.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@IfProfileValue(name="test-groups", values=["unit-tests", "integration-tests"]) // <1>
|
||||
@Test
|
||||
@@ -83,6 +84,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Run this test for unit tests and integration tests.
|
||||
======
|
||||
|
||||
|
||||
[[integration-testing-annotations-junit4-profilevaluesourceconfiguration]]
|
||||
@@ -105,11 +107,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Use a custom profile value source.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ProfileValueSourceConfiguration(CustomProfileValueSource::class) // <1>
|
||||
class CustomProfileValueSourceTests {
|
||||
@@ -117,6 +119,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Use a custom profile value source.
|
||||
======
|
||||
|
||||
|
||||
[[integration-testing-annotations-junit4-timed]]
|
||||
@@ -141,11 +144,11 @@ Java::
|
||||
// some logic that should not take longer than 1 second to run
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Set the time period for the test to one second.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Timed(millis = 1000) // <1>
|
||||
fun testProcessWithOneSecondTimeout() {
|
||||
@@ -153,6 +156,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Set the time period for the test to one second.
|
||||
======
|
||||
|
||||
|
||||
Spring's `@Timed` annotation has different semantics than JUnit 4's `@Test(timeout=...)`
|
||||
@@ -186,11 +190,11 @@ Java::
|
||||
// ...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Repeat this test ten times.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Repeat(10) // <1>
|
||||
@Test
|
||||
@@ -199,6 +203,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Repeat this test ten times.
|
||||
======
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Indicate that the `dev` profile should be active.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@ActiveProfiles("dev") // <1>
|
||||
@@ -32,6 +32,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Indicate that the `dev` profile should be active.
|
||||
======
|
||||
|
||||
|
||||
The following example indicates that both the `dev` and the `integration` profiles should
|
||||
@@ -49,11 +50,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Indicate that the `dev` and `integration` profiles should be active.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@ActiveProfiles(["dev", "integration"]) // <1>
|
||||
@@ -62,6 +63,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Indicate that the `dev` and `integration` profiles should be active.
|
||||
======
|
||||
|
||||
|
||||
NOTE: `@ActiveProfiles` provides support for inheriting active bean definition profiles
|
||||
|
||||
@@ -18,11 +18,11 @@ Java::
|
||||
// logic to be run after a transaction has ended
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Run this method after a transaction.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@AfterTransaction // <1>
|
||||
fun afterTransaction() {
|
||||
@@ -30,5 +30,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Run this method after a transaction.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ Java::
|
||||
// logic to be run before a transaction is started
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Run this method before a transaction.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@BeforeTransaction // <1>
|
||||
fun beforeTransaction() {
|
||||
@@ -32,5 +32,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Run this method before a transaction.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ Java::
|
||||
// ...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Commit the result of the test to the database.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Commit // <1>
|
||||
@Test
|
||||
@@ -34,5 +34,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Commit the result of the test to the database.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Referring to an XML file.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration("/test-config.xml") // <1>
|
||||
class XmlApplicationContextTests {
|
||||
@@ -38,6 +38,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Referring to an XML file.
|
||||
======
|
||||
|
||||
|
||||
The following example shows a `@ContextConfiguration` annotation that refers to a class:
|
||||
@@ -53,11 +54,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Referring to a class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration(classes = [TestConfig::class]) // <1>
|
||||
class ConfigClassApplicationContextTests {
|
||||
@@ -65,6 +66,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Referring to a class.
|
||||
======
|
||||
|
||||
|
||||
As an alternative or in addition to declaring resource locations or component classes,
|
||||
@@ -82,11 +84,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Declaring an initializer class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration(initializers = [CustomContextInitializer::class]) // <1>
|
||||
class ContextInitializerTests {
|
||||
@@ -94,6 +96,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Declaring an initializer class.
|
||||
======
|
||||
|
||||
|
||||
You can optionally use `@ContextConfiguration` to declare the `ContextLoader` strategy as
|
||||
@@ -114,11 +117,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Configuring both a location and a custom loader.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration("/test-context.xml", loader = CustomContextLoader::class) // <1>
|
||||
class CustomLoaderXmlApplicationContextTests {
|
||||
@@ -126,6 +129,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Configuring both a location and a custom loader.
|
||||
======
|
||||
|
||||
|
||||
NOTE: `@ContextConfiguration` provides support for inheriting resource locations or
|
||||
|
||||
@@ -31,11 +31,11 @@ Java::
|
||||
// some tests that require a new Spring container
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context before the current test class.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext(classMode = BEFORE_CLASS) // <1>
|
||||
class FreshContextTests {
|
||||
@@ -43,6 +43,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context before the current test class.
|
||||
======
|
||||
|
||||
* After the current test class, when declared on a class with class mode set to
|
||||
`AFTER_CLASS` (i.e., the default class mode).
|
||||
@@ -58,11 +59,11 @@ Java::
|
||||
// some tests that result in the Spring container being dirtied
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context after the current test class.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext // <1>
|
||||
class ContextDirtyingTests {
|
||||
@@ -70,6 +71,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context after the current test class.
|
||||
======
|
||||
|
||||
|
||||
* Before each test method in the current test class, when declared on a class with class
|
||||
@@ -86,11 +88,11 @@ Java::
|
||||
// some tests that require a new Spring container
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context before each test method.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD) // <1>
|
||||
class FreshContextTests {
|
||||
@@ -98,6 +100,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context before each test method.
|
||||
======
|
||||
|
||||
|
||||
* After each test method in the current test class, when declared on a class with class
|
||||
@@ -114,11 +117,11 @@ Java::
|
||||
// some tests that result in the Spring container being dirtied
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context after each test method.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) // <1>
|
||||
class ContextDirtyingTests {
|
||||
@@ -126,6 +129,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context after each test method.
|
||||
======
|
||||
|
||||
|
||||
* Before the current test, when declared on a method with the method mode set to
|
||||
@@ -143,11 +147,11 @@ Java::
|
||||
// some logic that requires a new Spring container
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context before the current test method.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext(methodMode = BEFORE_METHOD) // <1>
|
||||
@Test
|
||||
@@ -156,6 +160,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context before the current test method.
|
||||
======
|
||||
|
||||
* After the current test, when declared on a method with the method mode set to
|
||||
`AFTER_METHOD` (i.e., the default method mode).
|
||||
@@ -172,11 +177,11 @@ Java::
|
||||
// some logic that results in the Spring container being dirtied
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Dirty the context after the current test method.
|
||||
+
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@DirtiesContext // <1>
|
||||
@Test
|
||||
@@ -185,6 +190,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Dirty the context after the current test method.
|
||||
======
|
||||
|
||||
|
||||
If you use `@DirtiesContext` in a test whose context is configured as part of a context
|
||||
@@ -220,11 +226,11 @@ Java::
|
||||
}
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Use the current-level algorithm.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextHierarchy(
|
||||
ContextConfiguration("/parent-config.xml"),
|
||||
@@ -243,6 +249,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Use the current-level algorithm.
|
||||
======
|
||||
|
||||
|
||||
For further details regarding the `EXHAUSTIVE` and `CURRENT_LEVEL` algorithms, see the
|
||||
|
||||
@@ -29,13 +29,13 @@ Java::
|
||||
// tests ...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Annotate a `static` method with `@DynamicPropertySource`.
|
||||
<2> Accept a `DynamicPropertyRegistry` as an argument.
|
||||
<3> Register a dynamic `server.port` property to be retrieved lazily from the server.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
class MyIntegrationTests {
|
||||
@@ -58,6 +58,7 @@ Java::
|
||||
<1> Annotate a `static` method with `@DynamicPropertySource`.
|
||||
<2> Accept a `DynamicPropertyRegistry` as an argument.
|
||||
<3> Register a dynamic `server.port` property to be retrieved lazily from the server.
|
||||
======
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management/dynamic-property-sources.adoc[Context Configuration with Dynamic Property Sources] for further details.
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ Java::
|
||||
// ...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Do not roll back the result.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Rollback(false) // <1>
|
||||
@Test
|
||||
@@ -40,5 +40,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Do not roll back the result.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ Java::
|
||||
// run code that relies on the test schema and test data
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Run two scripts for this test.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Test
|
||||
@Sql("/test-schema.sql", "/test-user-data.sql") // <1>
|
||||
@@ -30,6 +30,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Run two scripts for this test.
|
||||
======
|
||||
|
||||
See xref:testing/testcontext-framework/executing-sql.adoc#testcontext-executing-sql-declaratively[Executing SQL scripts declaratively with @Sql] for further details.
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ Java::
|
||||
// run code that relies on the test data
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Set the comment prefix and the separator in SQL scripts.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Test
|
||||
@Sql("/test-user-data.sql", config = SqlConfig(commentPrefix = "`", separator = "@@")) // <1>
|
||||
@@ -32,4 +32,5 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Set the comment prefix and the separator in SQL scripts.
|
||||
======
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ Java::
|
||||
// run code that uses the test schema and test data
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Declare a group of SQL scripts.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@Test
|
||||
@SqlGroup( // <1>
|
||||
@@ -37,6 +37,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Declare a group of SQL scripts.
|
||||
======
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ Java::
|
||||
}
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Set the `@Sql` merge mode to `MERGE` for all test methods in the class.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig(TestConfig::class)
|
||||
@Sql("/test-schema.sql")
|
||||
@@ -48,6 +48,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Set the `@Sql` merge mode to `MERGE` for all test methods in the class.
|
||||
======
|
||||
|
||||
The following example shows how to use `@SqlMergeMode` at the method level.
|
||||
|
||||
@@ -69,11 +70,11 @@ Java::
|
||||
}
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Set the `@Sql` merge mode to `MERGE` for a specific test method.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@SpringJUnitConfig(TestConfig::class)
|
||||
@Sql("/test-schema.sql")
|
||||
@@ -88,5 +89,6 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Set the `@Sql` merge mode to `MERGE` for a specific test method.
|
||||
======
|
||||
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Register two `TestExecutionListener` implementations.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@TestExecutionListeners(CustomTestExecutionListener::class, AnotherTestExecutionListener::class) // <1>
|
||||
@@ -33,11 +33,12 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Register two `TestExecutionListener` implementations.
|
||||
======
|
||||
|
||||
|
||||
By default, `@TestExecutionListeners` provides support for inheriting listeners from
|
||||
superclasses or enclosing classes. See
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-nested-test-configuration[`@Nested` test class configuration] and the
|
||||
xref:testing/testcontext-framework/support-classes.adoc#testcontext-junit-jupiter-nested-test-configuration[`@Nested` test class configuration] and the
|
||||
{api-spring-framework}/test/context/TestExecutionListeners.html[`@TestExecutionListeners`
|
||||
javadoc] for an example and further details. If you discover that you need to switch
|
||||
back to using the default `TestExecutionListener` implementations, see the note
|
||||
|
||||
@@ -20,11 +20,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Get properties from `test.properties` in the root of the classpath.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@TestPropertySource("/test.properties") // <1>
|
||||
@@ -33,6 +33,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Get properties from `test.properties` in the root of the classpath.
|
||||
======
|
||||
|
||||
|
||||
The following example demonstrates how to declare inlined properties:
|
||||
@@ -49,11 +50,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Declare `timezone` and `port` properties.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@TestPropertySource(properties = ["timezone = GMT", "port: 4242"]) // <1>
|
||||
@@ -62,6 +63,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Declare `timezone` and `port` properties.
|
||||
======
|
||||
|
||||
See xref:testing/testcontext-framework/ctx-management/property-sources.adoc[Context Configuration with Test Property Sources] for examples and further details.
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> The `@WebAppConfiguration` annotation.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@WebAppConfiguration // <1>
|
||||
@@ -38,6 +38,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> The `@WebAppConfiguration` annotation.
|
||||
======
|
||||
--
|
||||
|
||||
|
||||
@@ -59,11 +60,11 @@ Java::
|
||||
// class body...
|
||||
}
|
||||
----
|
||||
======
|
||||
<1> Specifying a classpath resource.
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
|
||||
.Kotlin
|
||||
----
|
||||
@ContextConfiguration
|
||||
@WebAppConfiguration("classpath:test-web-resources") // <1>
|
||||
@@ -72,6 +73,7 @@ Java::
|
||||
}
|
||||
----
|
||||
<1> Specifying a classpath resource.
|
||||
======
|
||||
--
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user