Add support for bean overriding in tests

This commit introduces two sets of annotations (`@TestBean` on one side
and `MockitoBean`/`MockitoSpyBean` on the other side), as well as an
extension mecanism based on the `@BeanOverride` meta-annotation.

Extension implementors are expected to only provide an annotation,
a BeanOverrideProcessor implementation and an OverrideMetadata subclass.

Closes gh-29917.
This commit is contained in:
Simon Baslé
2023-12-14 11:43:37 +01:00
parent 90867e7e62
commit e1bbdf0913
41 changed files with 3516 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ dependencies {
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
optional("org.junit.jupiter:junit-jupiter-api")
optional("org.junit.platform:junit-platform-launcher") // for AOT processing
optional("org.mockito:mockito-core")
optional("org.seleniumhq.selenium:htmlunit-driver") {
exclude group: "commons-logging", module: "commons-logging"
exclude group: "net.bytebuddy", module: "byte-buddy"
@@ -79,6 +80,7 @@ dependencies {
testImplementation("org.hibernate:hibernate-validator")
testImplementation("org.hsqldb:hsqldb")
testImplementation("org.junit.platform:junit-platform-testkit")
testImplementation("org.mockito:mockito-core")
testRuntimeOnly("com.sun.xml.bind:jaxb-core")
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
testRuntimeOnly("org.glassfish:jakarta.el")