Merge pull request #39864 from wanger26
* gh-39864: Polish "Deprecate @MockBean and @SpyBean" Deprecate @MockBean and @SpyBean Closes gh-39864
This commit is contained in:
commit
d32d69ceb5
|
|
@ -171,6 +171,7 @@ dependencies {
|
||||||
testImplementation("org.skyscreamer:jsonassert")
|
testImplementation("org.skyscreamer:jsonassert")
|
||||||
testImplementation("org.springframework:spring-core-test")
|
testImplementation("org.springframework:spring-core-test")
|
||||||
testImplementation("org.springframework:spring-orm")
|
testImplementation("org.springframework:spring-orm")
|
||||||
|
testImplementation("org.springframework:spring-test")
|
||||||
testImplementation("org.springframework.data:spring-data-rest-webmvc")
|
testImplementation("org.springframework.data:spring-data-rest-webmvc")
|
||||||
testImplementation("org.springframework.integration:spring-integration-jmx")
|
testImplementation("org.springframework.integration:spring-integration-jmx")
|
||||||
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
|
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc")
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.actuate.audit.AuditEvent;
|
import org.springframework.boot.actuate.audit.AuditEvent;
|
||||||
import org.springframework.boot.actuate.audit.AuditEventRepository;
|
import org.springframework.boot.actuate.audit.AuditEventRepository;
|
||||||
import org.springframework.boot.actuate.audit.AuditEventsEndpoint;
|
import org.springframework.boot.actuate.audit.AuditEventsEndpoint;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
|
@ -48,7 +48,7 @@ import static org.springframework.restdocs.request.RequestDocumentation.queryPar
|
||||||
*/
|
*/
|
||||||
class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private AuditEventRepository repository;
|
private AuditEventRepository repository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ import org.springframework.boot.actuate.web.exchanges.HttpExchangesEndpoint;
|
||||||
import org.springframework.boot.actuate.web.exchanges.Include;
|
import org.springframework.boot.actuate.web.exchanges.Include;
|
||||||
import org.springframework.boot.actuate.web.exchanges.RecordableHttpRequest;
|
import org.springframework.boot.actuate.web.exchanges.RecordableHttpRequest;
|
||||||
import org.springframework.boot.actuate.web.exchanges.RecordableHttpResponse;
|
import org.springframework.boot.actuate.web.exchanges.RecordableHttpResponse;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.restdocs.payload.JsonFieldType;
|
import org.springframework.restdocs.payload.JsonFieldType;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
|
|
@ -56,7 +56,7 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
|
||||||
*/
|
*/
|
||||||
class HttpExchangesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
class HttpExchangesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private HttpExchangeRepository repository;
|
private HttpExchangeRepository repository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import org.springframework.boot.logging.LogLevel;
|
||||||
import org.springframework.boot.logging.LoggerConfiguration;
|
import org.springframework.boot.logging.LoggerConfiguration;
|
||||||
import org.springframework.boot.logging.LoggerGroups;
|
import org.springframework.boot.logging.LoggerGroups;
|
||||||
import org.springframework.boot.logging.LoggingSystem;
|
import org.springframework.boot.logging.LoggingSystem;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
@ -38,6 +37,7 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.restdocs.payload.JsonFieldType;
|
import org.springframework.restdocs.payload.JsonFieldType;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
|
|
@ -62,7 +62,7 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
|
||||||
.type(JsonFieldType.STRING)
|
.type(JsonFieldType.STRING)
|
||||||
.optional(), fieldWithPath("members").description("Loggers that are part of this group"));
|
.optional(), fieldWithPath("members").description("Loggers that are part of this group"));
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private LoggingSystem loggingSystem;
|
private LoggingSystem loggingSystem;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,13 @@ import org.quartz.spi.OperableTrigger;
|
||||||
import org.springframework.boot.actuate.endpoint.Show;
|
import org.springframework.boot.actuate.endpoint.Show;
|
||||||
import org.springframework.boot.actuate.quartz.QuartzEndpoint;
|
import org.springframework.boot.actuate.quartz.QuartzEndpoint;
|
||||||
import org.springframework.boot.actuate.quartz.QuartzEndpointWebExtension;
|
import org.springframework.boot.actuate.quartz.QuartzEndpointWebExtension;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
import org.springframework.restdocs.payload.JsonFieldType;
|
import org.springframework.restdocs.payload.JsonFieldType;
|
||||||
import org.springframework.scheduling.quartz.DelegatingJob;
|
import org.springframework.scheduling.quartz.DelegatingJob;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ class QuartzEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
|
||||||
.type(JsonFieldType.OBJECT)
|
.type(JsonFieldType.OBJECT)
|
||||||
.description("Job data map keyed by name, if any.") };
|
.description("Job data map keyed by name, if any.") };
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private Scheduler scheduler;
|
private Scheduler scheduler;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.boot.actuate.context.ShutdownEndpoint;
|
import org.springframework.boot.actuate.context.ShutdownEndpoint;
|
||||||
import org.springframework.boot.actuate.session.SessionsEndpoint;
|
import org.springframework.boot.actuate.session.SessionsEndpoint;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
@ -36,6 +35,7 @@ import org.springframework.session.FindByIndexNameSessionRepository;
|
||||||
import org.springframework.session.MapSession;
|
import org.springframework.session.MapSession;
|
||||||
import org.springframework.session.Session;
|
import org.springframework.session.Session;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
|
|
@ -72,7 +72,7 @@ class SessionsEndpointDocumentationTests extends MockMvcEndpointDocumentationTes
|
||||||
.description("Maximum permitted period of inactivity, in seconds, before the session will expire."),
|
.description("Maximum permitted period of inactivity, in seconds, before the session will expire."),
|
||||||
fieldWithPath("expired").description("Whether the session has expired."));
|
fieldWithPath("expired").description("Whether the session has expired."));
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private FindByIndexNameSessionRepository<Session> sessionRepository;
|
private FindByIndexNameSessionRepository<Session> sessionRepository;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ JUnit 5 enables a test class to be instantiated once and reused for all of the c
|
||||||
This makes it possible to use `@BeforeAll` and `@AfterAll` annotations on non-static methods, which is a good fit for Kotlin.
|
This makes it possible to use `@BeforeAll` and `@AfterAll` annotations on non-static methods, which is a good fit for Kotlin.
|
||||||
|
|
||||||
To mock Kotlin classes, https://mockk.io/[MockK] is recommended.
|
To mock Kotlin classes, https://mockk.io/[MockK] is recommended.
|
||||||
If you need the `MockK` equivalent of the Mockito specific xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.mocking-beans[`@MockBean` and `@SpyBean` annotations], you can use https://github.com/Ninja-Squad/springmockk[SpringMockK] which provides similar `@MockkBean` and `@SpykBean` annotations.
|
If you need the `MockK` equivalent of the Mockito specific xref:testing/spring-boot-applications.adoc#testing.spring-boot-applications.mocking-beans[`@MockitoBean` and `@MockitoSpyBean` annotations], you can use https://github.com/Ninja-Squad/springmockk[SpringMockK] which provides similar `@MockkBean` and `@SpykBean` annotations.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,38 +247,9 @@ When running tests, it is sometimes necessary to mock certain components within
|
||||||
For example, you may have a facade over some remote service that is unavailable during development.
|
For example, you may have a facade over some remote service that is unavailable during development.
|
||||||
Mocking can also be useful when you want to simulate failures that might be hard to trigger in a real environment.
|
Mocking can also be useful when you want to simulate failures that might be hard to trigger in a real environment.
|
||||||
|
|
||||||
Spring Boot includes a `@MockBean` annotation that can be used to define a Mockito mock for a bean inside your `ApplicationContext`.
|
Spring Framework includes a `@MockitoBean` annotation that can be used to define a Mockito mock for a bean inside your `ApplicationContext`.
|
||||||
You can use the annotation to add new beans or replace a single existing bean definition.
|
Additionally, `@MockitoSpyBean` can be used to define a Mockito spy.
|
||||||
The annotation can be used directly on test classes, on fields within your test, or on `@Configuration` classes and fields.
|
Learn more about these features in the {url-spring-framework-docs}/testing/annotations/integration-spring/annotation-mockitobean.html[Spring Framework documentation].
|
||||||
When used on a field, the instance of the created mock is also injected.
|
|
||||||
Mock beans are automatically reset after each test method.
|
|
||||||
|
|
||||||
[NOTE]
|
|
||||||
====
|
|
||||||
If your test uses one of Spring Boot's test annotations (such as `@SpringBootTest`), this feature is automatically enabled.
|
|
||||||
To use this feature with a different arrangement, listeners must be explicitly added, as shown in the following example:
|
|
||||||
|
|
||||||
include-code::listener/MyTests[]
|
|
||||||
====
|
|
||||||
|
|
||||||
The following example replaces an existing `RemoteService` bean with a mock implementation:
|
|
||||||
|
|
||||||
include-code::bean/MyTests[]
|
|
||||||
|
|
||||||
NOTE: `@MockBean` cannot be used to mock the behavior of a bean that is exercised during application context refresh.
|
|
||||||
By the time the test is executed, the application context refresh has completed and it is too late to configure the mocked behavior.
|
|
||||||
We recommend using a `@Bean` method to create and configure the mock in this situation.
|
|
||||||
|
|
||||||
Additionally, you can use `@SpyBean` to wrap any existing bean with a Mockito `spy`.
|
|
||||||
See the xref:api:java/org/springframework/boot/test/mock/mockito/SpyBean.html[`SpyBean`] API documentation for full details.
|
|
||||||
|
|
||||||
NOTE: While Spring's test framework caches application contexts between tests and reuses a context for tests sharing the same configuration, the use of `@MockBean` or `@SpyBean` influences the cache key, which will most likely increase the number of contexts.
|
|
||||||
|
|
||||||
TIP: If you are using `@SpyBean` to spy on a bean with `@Cacheable` methods that refer to parameters by name, your application must be compiled with `-parameters`.
|
|
||||||
This ensures that the parameter names are available to the caching infrastructure once the bean has been spied upon.
|
|
||||||
|
|
||||||
TIP: When you are using `@SpyBean` to spy on a bean that is proxied by Spring, you may need to remove Spring's proxy in some situations, for example when setting expectations using `given` or `when`.
|
|
||||||
Use `AopTestUtils.getTargetObject(yourProxiedSpy)` to do so.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.testing.springbootapplications.mockingbeans.bean;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import static org.mockito.BDDMockito.given;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class MyTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Reverser reverser;
|
|
||||||
|
|
||||||
@MockBean
|
|
||||||
private RemoteService remoteService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void exampleTest() {
|
|
||||||
given(this.remoteService.getValue()).willReturn("spring");
|
|
||||||
String reverse = this.reverser.getReverseValue(); // Calls injected RemoteService
|
|
||||||
assertThat(reverse).isEqualTo("gnirps");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.testing.springbootapplications.mockingbeans.bean;
|
|
||||||
|
|
||||||
class RemoteService {
|
|
||||||
|
|
||||||
Object getValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.testing.springbootapplications.mockingbeans.bean;
|
|
||||||
|
|
||||||
class Reverser {
|
|
||||||
|
|
||||||
String getReverseValue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.testing.springbootapplications.mockingbeans.listener;
|
|
||||||
|
|
||||||
class MyConfig {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.testing.springbootapplications.mockingbeans.listener;
|
|
||||||
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener;
|
|
||||||
import org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.TestExecutionListeners;
|
|
||||||
|
|
||||||
@ContextConfiguration(classes = MyConfig.class)
|
|
||||||
@TestExecutionListeners({ MockitoTestExecutionListener.class, ResetMocksTestExecutionListener.class })
|
|
||||||
class MyTests {
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
@ -33,7 +33,7 @@ class MyControllerTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MockMvcTester mvc;
|
private MockMvcTester mvc;
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private UserVehicleService userVehicleService;
|
private UserVehicleService userVehicleService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
|
|
@ -33,7 +33,7 @@ class MyHtmlUnitTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WebClient webClient;
|
private WebClient webClient;
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private UserVehicleService userVehicleService;
|
private UserVehicleService userVehicleService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
|
|
||||||
import static org.mockito.BDDMockito.given;
|
import static org.mockito.BDDMockito.given;
|
||||||
|
|
@ -32,7 +32,7 @@ class MyControllerTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WebTestClient webClient;
|
private WebTestClient webClient;
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private UserVehicleService userVehicleService;
|
private UserVehicleService userVehicleService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2022 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.features.testing.springbootapplications.mockingbeans.bean
|
|
||||||
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
import org.mockito.BDDMockito.given
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class MyTests(@Autowired val reverser: Reverser, @MockBean val remoteService: RemoteService) {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun exampleTest() {
|
|
||||||
given(remoteService.value).willReturn("spring")
|
|
||||||
val reverse = reverser.reverseValue // Calls injected RemoteService
|
|
||||||
assertThat(reverse).isEqualTo("gnirps")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2022 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.features.testing.springbootapplications.mockingbeans.bean
|
|
||||||
|
|
||||||
class RemoteService {
|
|
||||||
|
|
||||||
val value: Any?
|
|
||||||
get() = null
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2022 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.features.testing.springbootapplications.mockingbeans.bean
|
|
||||||
|
|
||||||
class Reverser {
|
|
||||||
|
|
||||||
val reverseValue: String?
|
|
||||||
get() = null
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2022 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.features.testing.springbootapplications.mockingbeans.listener
|
|
||||||
|
|
||||||
class MyConfig
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012-2022 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.springframework.boot.docs.features.testing.springbootapplications.mockingbeans.listener
|
|
||||||
|
|
||||||
import org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener
|
|
||||||
import org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener
|
|
||||||
import org.springframework.test.context.ContextConfiguration
|
|
||||||
import org.springframework.test.context.TestExecutionListeners
|
|
||||||
|
|
||||||
@ContextConfiguration(classes = [MyConfig::class])
|
|
||||||
@TestExecutionListeners(
|
|
||||||
MockitoTestExecutionListener::class,
|
|
||||||
ResetMocksTestExecutionListener::class
|
|
||||||
)
|
|
||||||
class MyTests {
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -21,14 +21,14 @@ import org.junit.jupiter.api.Test
|
||||||
import org.mockito.BDDMockito.given
|
import org.mockito.BDDMockito.given
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean
|
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean
|
||||||
import org.springframework.test.web.servlet.assertj.MockMvcTester
|
import org.springframework.test.web.servlet.assertj.MockMvcTester
|
||||||
|
|
||||||
@WebMvcTest(UserVehicleController::class)
|
@WebMvcTest(UserVehicleController::class)
|
||||||
class MyControllerTests(@Autowired val mvc: MockMvcTester) {
|
class MyControllerTests(@Autowired val mvc: MockMvcTester) {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
lateinit var userVehicleService: UserVehicleService
|
lateinit var userVehicleService: UserVehicleService
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -23,12 +23,12 @@ import org.junit.jupiter.api.Test
|
||||||
import org.mockito.BDDMockito.given
|
import org.mockito.BDDMockito.given
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean
|
import org.springframework.test.context.bean.override.mockito.MockitoBean
|
||||||
|
|
||||||
@WebMvcTest(UserVehicleController::class)
|
@WebMvcTest(UserVehicleController::class)
|
||||||
class MyHtmlUnitTests(@Autowired val webClient: WebClient) {
|
class MyHtmlUnitTests(@Autowired val webClient: WebClient) {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
lateinit var userVehicleService: UserVehicleService
|
lateinit var userVehicleService: UserVehicleService
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -20,15 +20,15 @@ import org.junit.jupiter.api.Test
|
||||||
import org.mockito.BDDMockito.given
|
import org.mockito.BDDMockito.given
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
|
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean
|
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient
|
import org.springframework.test.web.reactive.server.WebTestClient
|
||||||
import org.springframework.test.web.reactive.server.expectBody
|
import org.springframework.test.web.reactive.server.expectBody
|
||||||
|
|
||||||
@WebFluxTest(UserVehicleController::class)
|
@WebFluxTest(UserVehicleController::class)
|
||||||
class MyControllerTests(@Autowired val webClient: WebTestClient) {
|
class MyControllerTests(@Autowired val webClient: WebTestClient) {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
lateinit var userVehicleService: UserVehicleService
|
lateinit var userVehicleService: UserVehicleService
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint;
|
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.boot.test.system.CapturedOutput;
|
import org.springframework.boot.test.system.CapturedOutput;
|
||||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.security.test.context.support.WithMockUser;
|
import org.springframework.security.test.context.support.WithMockUser;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
@ExtendWith(OutputCaptureExtension.class)
|
@ExtendWith(OutputCaptureExtension.class)
|
||||||
class MockMvcSpringBootTestIntegrationTests {
|
class MockMvcSpringBootTestIntegrationTests {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private ExampleMockableService service;
|
private ExampleMockableService service;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint;
|
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.boot.test.system.CapturedOutput;
|
import org.springframework.boot.test.system.CapturedOutput;
|
||||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.security.test.context.support.WithMockUser;
|
import org.springframework.security.test.context.support.WithMockUser;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||||
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@ExtendWith(OutputCaptureExtension.class)
|
@ExtendWith(OutputCaptureExtension.class)
|
||||||
class MockMvcTesterSpringBootTestIntegrationTests {
|
class MockMvcTesterSpringBootTestIntegrationTests {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
private ExampleMockableService service;
|
private ExampleMockableService service;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ dependencies {
|
||||||
testImplementation("org.spockframework:spock-core")
|
testImplementation("org.spockframework:spock-core")
|
||||||
testImplementation("org.springframework:spring-webmvc")
|
testImplementation("org.springframework:spring-webmvc")
|
||||||
testImplementation("org.springframework:spring-core-test")
|
testImplementation("org.springframework:spring-core-test")
|
||||||
|
testImplementation("org.springframework:spring-test")
|
||||||
testImplementation("org.testng:testng")
|
testImplementation("org.testng:testng")
|
||||||
|
|
||||||
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
|
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -24,6 +24,8 @@ import org.springframework.util.ObjectUtils;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see DefinitionsParser
|
* @see DefinitionsParser
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
abstract class Definition {
|
abstract class Definition {
|
||||||
|
|
||||||
private static final int MULTIPLIER = 31;
|
private static final int MULTIPLIER = 31;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -42,6 +42,8 @@ import org.springframework.util.StringUtils;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class DefinitionsParser {
|
class DefinitionsParser {
|
||||||
|
|
||||||
private final Set<Definition> definitions;
|
private final Set<Definition> definitions;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -91,7 +91,11 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
* @see MockitoPostProcessor
|
* @see MockitoPostProcessor
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoBean}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Target({ ElementType.TYPE, ElementType.FIELD })
|
@Target({ ElementType.TYPE, ElementType.FIELD })
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,7 +33,11 @@ import java.lang.annotation.Target;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoBean}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@Documented
|
@Documented
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -38,6 +38,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockDefinition extends Definition {
|
class MockDefinition extends Definition {
|
||||||
|
|
||||||
private static final int MULTIPLIER = 31;
|
private static final int MULTIPLIER = 31;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,11 @@ import org.springframework.util.Assert;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
* @see ResetMocksTestExecutionListener
|
* @see ResetMocksTestExecutionListener
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockReset}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
public enum MockReset {
|
public enum MockReset {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -29,6 +29,8 @@ import org.springframework.test.context.MergedContextConfiguration;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockitoContextCustomizer implements ContextCustomizer {
|
class MockitoContextCustomizer implements ContextCustomizer {
|
||||||
|
|
||||||
private final Set<Definition> definitions;
|
private final Set<Definition> definitions;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,6 +28,8 @@ import org.springframework.test.context.TestContextAnnotationUtils;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockitoContextCustomizerFactory implements ContextCustomizerFactory {
|
class MockitoContextCustomizerFactory implements ContextCustomizerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ import org.springframework.core.Conventions;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.PriorityOrdered;
|
import org.springframework.core.PriorityOrdered;
|
||||||
import org.springframework.core.ResolvableType;
|
import org.springframework.core.ResolvableType;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
@ -76,7 +78,11 @@ import org.springframework.util.StringUtils;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @author Andreas Neiser
|
* @author Andreas Neiser
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of Spring Framework's
|
||||||
|
* {@link MockitoBean} and {@link MockitoSpyBean} support
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0")
|
||||||
public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor, BeanClassLoaderAware,
|
public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor, BeanClassLoaderAware,
|
||||||
BeanFactoryAware, BeanFactoryPostProcessor, Ordered {
|
BeanFactoryAware, BeanFactoryPostProcessor, Ordered {
|
||||||
|
|
||||||
|
|
@ -420,7 +426,7 @@ public class MockitoPostProcessor implements InstantiationAwareBeanPostProcessor
|
||||||
RootBeanDefinition definition = new RootBeanDefinition(postProcessor);
|
RootBeanDefinition definition = new RootBeanDefinition(postProcessor);
|
||||||
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues();
|
ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues();
|
||||||
constructorArguments.addIndexedArgumentValue(0, new LinkedHashSet<MockDefinition>());
|
constructorArguments.addIndexedArgumentValue(0, new LinkedHashSet<>());
|
||||||
registry.registerBeanDefinition(BEAN_NAME, definition);
|
registry.registerBeanDefinition(BEAN_NAME, definition);
|
||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,11 @@ import org.springframework.util.ReflectionUtils;
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
* @since 1.4.2
|
* @since 1.4.2
|
||||||
* @see ResetMocksTestExecutionListener
|
* @see ResetMocksTestExecutionListener
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoTestExecutionListener}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
public class MockitoTestExecutionListener extends AbstractTestExecutionListener {
|
public class MockitoTestExecutionListener extends AbstractTestExecutionListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import org.springframework.core.annotation.MergedAnnotations;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @see Definition
|
* @see Definition
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class QualifierDefinition {
|
class QualifierDefinition {
|
||||||
|
|
||||||
private final Field field;
|
private final Field field;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,11 @@ import org.springframework.util.ClassUtils;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
* @see MockitoTestExecutionListener
|
* @see MockitoTestExecutionListener
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoResetTestExecutionListener}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
public class ResetMocksTestExecutionListener extends AbstractTestExecutionListener {
|
public class ResetMocksTestExecutionListener extends AbstractTestExecutionListener {
|
||||||
|
|
||||||
private static final boolean MOCKITO_IS_PRESENT = ClassUtils.isPresent("org.mockito.MockSettings",
|
private static final boolean MOCKITO_IS_PRESENT = ClassUtils.isPresent("org.mockito.MockSettings",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -21,6 +21,8 @@ import org.mockito.plugins.MockResolver;
|
||||||
import org.springframework.aop.TargetSource;
|
import org.springframework.aop.TargetSource;
|
||||||
import org.springframework.aop.framework.Advised;
|
import org.springframework.aop.framework.Advised;
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -29,7 +31,10 @@ import org.springframework.util.Assert;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of Spring Framework's
|
||||||
|
* {@link MockitoBean} and {@link MockitoSpyBean}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
public class SpringBootMockResolver implements MockResolver {
|
public class SpringBootMockResolver implements MockResolver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -89,7 +89,11 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
* @see MockitoPostProcessor
|
* @see MockitoPostProcessor
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoSpyBean}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Target({ ElementType.TYPE, ElementType.FIELD })
|
@Target({ ElementType.TYPE, ElementType.FIELD })
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,7 +33,11 @@ import java.lang.annotation.Target;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoSpyBean}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@Documented
|
@Documented
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -38,6 +38,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class SpyDefinition extends Definition {
|
class SpyDefinition extends Definition {
|
||||||
|
|
||||||
private static final int MULTIPLIER = 31;
|
private static final int MULTIPLIER = 31;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -16,5 +16,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mockito integration for Spring Boot tests.
|
* Mockito integration for Spring Boot tests.
|
||||||
|
* @deprecated since 3.4.0 for removal in 3.6.0 in favor of Spring Framework's
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoBean} and
|
||||||
|
* {@link org.springframework.test.context.bean.override.mockito.MockitoSpyBean}
|
||||||
*/
|
*/
|
||||||
package org.springframework.boot.test.mock.mockito;
|
package org.springframework.boot.test.mock.mockito;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -24,9 +24,9 @@ import org.springframework.boot.SpringBootConfiguration;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.context.nestedtests.InheritedNestedTestConfigurationTests.ActionPerformer;
|
import org.springframework.boot.test.context.nestedtests.InheritedNestedTestConfigurationTests.ActionPerformer;
|
||||||
import org.springframework.boot.test.context.nestedtests.InheritedNestedTestConfigurationTests.AppConfiguration;
|
import org.springframework.boot.test.context.nestedtests.InheritedNestedTestConfigurationTests.AppConfiguration;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||||
|
|
||||||
import static org.mockito.BDDMockito.then;
|
import static org.mockito.BDDMockito.then;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
|
|
@ -41,7 +41,7 @@ import static org.mockito.Mockito.times;
|
||||||
@Import(ActionPerformer.class)
|
@Import(ActionPerformer.class)
|
||||||
class InheritedNestedTestConfigurationTests {
|
class InheritedNestedTestConfigurationTests {
|
||||||
|
|
||||||
@MockBean
|
@MockitoBean
|
||||||
Action action;
|
Action action;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito;
|
||||||
*
|
*
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class AbstractMockBeanOnGenericExtensionTests extends
|
class AbstractMockBeanOnGenericExtensionTests extends
|
||||||
AbstractMockBeanOnGenericTests<AbstractMockBeanOnGenericTests.ThingImpl, AbstractMockBeanOnGenericTests.SomethingImpl> {
|
AbstractMockBeanOnGenericTests<AbstractMockBeanOnGenericTests.ThingImpl, AbstractMockBeanOnGenericTests.SomethingImpl> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -32,6 +32,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
* @param <U> type of something
|
* @param <U> type of something
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@SpringBootTest(classes = AbstractMockBeanOnGenericTests.TestConfiguration.class)
|
@SpringBootTest(classes = AbstractMockBeanOnGenericTests.TestConfiguration.class)
|
||||||
abstract class AbstractMockBeanOnGenericTests<T extends AbstractMockBeanOnGenericTests.Thing<U>, U extends AbstractMockBeanOnGenericTests.Something> {
|
abstract class AbstractMockBeanOnGenericTests<T extends AbstractMockBeanOnGenericTests.Thing<U>, U extends AbstractMockBeanOnGenericTests.Something> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,6 +37,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class DefinitionsParserTests {
|
class DefinitionsParserTests {
|
||||||
|
|
||||||
private final DefinitionsParser parser = new DefinitionsParser();
|
private final DefinitionsParser parser = new DefinitionsParser();
|
||||||
|
|
@ -190,22 +192,26 @@ class DefinitionsParserTests {
|
||||||
return new ArrayList<>(this.parser.getDefinitions());
|
return new ArrayList<>(this.parser.getDefinitions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
static class SingleMockBean {
|
static class SingleMockBean {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBeans({ @MockBean(ExampleService.class), @MockBean(ExampleServiceCaller.class) })
|
@MockBeans({ @MockBean(ExampleService.class), @MockBean(ExampleServiceCaller.class) })
|
||||||
static class RepeatMockBean {
|
static class RepeatMockBean {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean(name = "Name", classes = ExampleService.class, extraInterfaces = ExampleExtraInterface.class,
|
@MockBean(name = "Name", classes = ExampleService.class, extraInterfaces = ExampleExtraInterface.class,
|
||||||
answer = Answers.RETURNS_SMART_NULLS, serializable = true, reset = MockReset.NONE)
|
answer = Answers.RETURNS_SMART_NULLS, serializable = true, reset = MockReset.NONE)
|
||||||
static class MockBeanAttributes {
|
static class MockBeanAttributes {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
static class MockBeanOnClassAndField {
|
static class MockBeanOnClassAndField {
|
||||||
|
|
||||||
|
|
@ -215,11 +221,13 @@ class DefinitionsParserTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean({ ExampleService.class, ExampleServiceCaller.class })
|
@MockBean({ ExampleService.class, ExampleServiceCaller.class })
|
||||||
static class MockBeanMultipleClasses {
|
static class MockBeanMultipleClasses {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean(name = "name", classes = { ExampleService.class, ExampleServiceCaller.class })
|
@MockBean(name = "name", classes = { ExampleService.class, ExampleServiceCaller.class })
|
||||||
static class MockBeanMultipleClassesWithName {
|
static class MockBeanMultipleClassesWithName {
|
||||||
|
|
||||||
|
|
@ -232,26 +240,31 @@ class DefinitionsParserTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean
|
@MockBean
|
||||||
static class MockBeanMissingClassToMock {
|
static class MockBeanMissingClassToMock {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean(RealExampleService.class)
|
@SpyBean(RealExampleService.class)
|
||||||
static class SingleSpyBean {
|
static class SingleSpyBean {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBeans({ @SpyBean(RealExampleService.class), @SpyBean(ExampleServiceCaller.class) })
|
@SpyBeans({ @SpyBean(RealExampleService.class), @SpyBean(ExampleServiceCaller.class) })
|
||||||
static class RepeatSpyBean {
|
static class RepeatSpyBean {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean(name = "Name", classes = RealExampleService.class, reset = MockReset.NONE)
|
@SpyBean(name = "Name", classes = RealExampleService.class, reset = MockReset.NONE)
|
||||||
static class SpyBeanAttributes {
|
static class SpyBeanAttributes {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean(RealExampleService.class)
|
@SpyBean(RealExampleService.class)
|
||||||
static class SpyBeanOnClassAndField {
|
static class SpyBeanOnClassAndField {
|
||||||
|
|
||||||
|
|
@ -261,11 +274,13 @@ class DefinitionsParserTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean({ RealExampleService.class, ExampleServiceCaller.class })
|
@SpyBean({ RealExampleService.class, ExampleServiceCaller.class })
|
||||||
static class SpyBeanMultipleClasses {
|
static class SpyBeanMultipleClasses {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean(name = "name", classes = { RealExampleService.class, ExampleServiceCaller.class })
|
@SpyBean(name = "name", classes = { RealExampleService.class, ExampleServiceCaller.class })
|
||||||
static class SpyBeanMultipleClassesWithName {
|
static class SpyBeanMultipleClassesWithName {
|
||||||
|
|
||||||
|
|
@ -278,6 +293,7 @@ class DefinitionsParserTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@SpyBean
|
@SpyBean
|
||||||
static class SpyBeanMissingClassToMock {
|
static class SpyBeanMissingClassToMock {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -43,6 +43,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockBeanContextCachingTests {
|
class MockBeanContextCachingTests {
|
||||||
|
|
||||||
private final DefaultContextCache contextCache = new DefaultContextCache(2);
|
private final DefaultContextCache contextCache = new DefaultContextCache(2);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanForBeanFactoryIntegrationTests {
|
class MockBeanForBeanFactoryIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,6 +36,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
class MockBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
@ -48,6 +50,7 @@ class MockBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
||||||
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
@Import({ ExampleServiceCaller.class, FailingExampleService.class })
|
@Import({ ExampleServiceCaller.class, FailingExampleService.class })
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,9 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockBeanOnConfigurationClassForNewBeanIntegrationTests {
|
class MockBeanOnConfigurationClassForNewBeanIntegrationTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -47,6 +49,7 @@ class MockBeanOnConfigurationClassForNewBeanIntegrationTests {
|
||||||
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
@Import(ExampleServiceCaller.class)
|
@Import(ExampleServiceCaller.class)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,7 +36,9 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockBeanOnConfigurationFieldForExistingBeanIntegrationTests {
|
class MockBeanOnConfigurationFieldForExistingBeanIntegrationTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,7 +35,9 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockBeanOnConfigurationFieldForNewBeanIntegrationTests {
|
class MockBeanOnConfigurationFieldForNewBeanIntegrationTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,6 +39,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
|
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
|
||||||
@ContextConfiguration(classes = ChildConfig.class) })
|
@ContextConfiguration(classes = ChildConfig.class) })
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,6 +39,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5724">gh-5724</a>
|
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5724">gh-5724</a>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanOnScopedProxyTests {
|
class MockBeanOnScopedProxyTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
class MockBeanOnTestClassForExistingBeanIntegrationTests {
|
class MockBeanOnTestClassForExistingBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@MockBean(ExampleService.class)
|
@MockBean(ExampleService.class)
|
||||||
class MockBeanOnTestClassForNewBeanIntegrationTests {
|
class MockBeanOnTestClassForNewBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,6 +37,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see MockBeanOnTestFieldForExistingBeanIntegrationTests
|
* @see MockBeanOnTestFieldForExistingBeanIntegrationTests
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
|
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
|
||||||
class MockBeanOnTestFieldForExistingBeanCacheIntegrationTests {
|
class MockBeanOnTestFieldForExistingBeanCacheIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,6 +28,8 @@ import org.springframework.context.annotation.Import;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Import({ ExampleServiceCaller.class, FailingExampleService.class })
|
@Import({ ExampleServiceCaller.class, FailingExampleService.class })
|
||||||
public class MockBeanOnTestFieldForExistingBeanConfig {
|
public class MockBeanOnTestFieldForExistingBeanConfig {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see MockBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
* @see MockBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
|
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
|
||||||
class MockBeanOnTestFieldForExistingBeanIntegrationTests {
|
class MockBeanOnTestFieldForExistingBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,6 +40,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanOnTestFieldForNewBeanIntegrationTests {
|
class MockBeanOnTestFieldForNewBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -46,6 +46,8 @@ import static org.mockito.Mockito.times;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanWithAopProxyTests {
|
class MockBeanWithAopProxyTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,6 +34,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanWithAsyncInterfaceMethodIntegrationTests {
|
class MockBeanWithAsyncInterfaceMethodIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,6 +37,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
|
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
|
||||||
class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests {
|
class MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -32,6 +32,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockBeanWithInjectedFieldIntegrationTests {
|
class MockBeanWithInjectedFieldIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -31,6 +31,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/27693">gh-27693</a>
|
* @see <a href="https://github.com/spring-projects/spring-boot/issues/27693">gh-27693</a>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
public class MockBeanWithSpringMethodRuleRepeatJUnit4IntegrationTests {
|
public class MockBeanWithSpringMethodRuleRepeatJUnit4IntegrationTests {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,6 +34,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockDefinitionTests {
|
class MockDefinitionTests {
|
||||||
|
|
||||||
private static final ResolvableType EXAMPLE_SERVICE_TYPE = ResolvableType.forClass(ExampleService.class);
|
private static final ResolvableType EXAMPLE_SERVICE_TYPE = ResolvableType.forClass(ExampleService.class);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -29,6 +29,8 @@ import static org.mockito.Mockito.withSettings;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockResetTests {
|
class MockResetTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -27,6 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockitoContextCustomizerFactoryTests {
|
class MockitoContextCustomizerFactoryTests {
|
||||||
|
|
||||||
private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory();
|
private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory();
|
||||||
|
|
@ -60,16 +62,19 @@ class MockitoContextCustomizerFactoryTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean({ Service1.class, Service2.class })
|
@MockBean({ Service1.class, Service2.class })
|
||||||
static class WithMockBeanAnnotation {
|
static class WithMockBeanAnnotation {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean({ Service2.class, Service1.class })
|
@MockBean({ Service2.class, Service1.class })
|
||||||
static class WithSameMockBeanAnnotation {
|
static class WithSameMockBeanAnnotation {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@MockBean({ Service1.class })
|
@MockBean({ Service1.class })
|
||||||
static class WithDifferentMockBeanAnnotation {
|
static class WithDifferentMockBeanAnnotation {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,6 +34,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockitoContextCustomizerTests {
|
class MockitoContextCustomizerTests {
|
||||||
|
|
||||||
private static final Set<MockDefinition> NO_DEFINITIONS = Collections.emptySet();
|
private static final Set<MockDefinition> NO_DEFINITIONS = Collections.emptySet();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -51,6 +51,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||||
* @author Andreas Neiser
|
* @author Andreas Neiser
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class MockitoPostProcessorTests {
|
class MockitoPostProcessorTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ import static org.mockito.BDDMockito.given;
|
||||||
*
|
*
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class MockitoTestExecutionListenerIntegrationTests {
|
class MockitoTestExecutionListenerIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ import static org.mockito.Mockito.mock;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class MockitoTestExecutionListenerTests {
|
class MockitoTestExecutionListenerTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -41,6 +41,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class QualifierDefinitionTests {
|
class QualifierDefinitionTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,6 +40,8 @@ import static org.mockito.Mockito.mock;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@TestMethodOrder(MethodOrderer.MethodName.class)
|
@TestMethodOrder(MethodOrderer.MethodName.class)
|
||||||
class ResetMocksTestExecutionListenerTests {
|
class ResetMocksTestExecutionListenerTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -26,6 +26,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class SpringBootMockResolverIntegrationTests {
|
class SpringBootMockResolverIntegrationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
class SpringBootMockResolverTests {
|
class SpringBootMockResolverTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
@ -47,6 +49,7 @@ class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests {
|
||||||
then(this.caller.getService()).should().greeting();
|
then(this.caller.getService()).should().greeting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@SpyBean(SimpleExampleService.class)
|
@SpyBean(SimpleExampleService.class)
|
||||||
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })
|
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnConfigurationClassForNewBeanIntegrationTests {
|
class SpyBeanOnConfigurationClassForNewBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
@ -47,6 +49,7 @@ class SpyBeanOnConfigurationClassForNewBeanIntegrationTests {
|
||||||
then(this.caller.getService()).should().greeting();
|
then(this.caller.getService()).should().greeting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@SpyBean(SimpleExampleService.class)
|
@SpyBean(SimpleExampleService.class)
|
||||||
@Import(ExampleServiceCaller.class)
|
@Import(ExampleServiceCaller.class)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,6 +36,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests {
|
class SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnConfigurationFieldForNewBeanIntegrationTests {
|
class SpyBeanOnConfigurationFieldForNewBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -40,6 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
|
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
|
||||||
@ContextConfiguration(classes = ChildConfig.class) })
|
@ContextConfiguration(classes = ChildConfig.class) })
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,6 +34,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@SpyBean(SimpleExampleService.class)
|
@SpyBean(SimpleExampleService.class)
|
||||||
class SpyBeanOnTestClassForExistingBeanIntegrationTests {
|
class SpyBeanOnTestClassForExistingBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -34,6 +34,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@SpyBean(SimpleExampleService.class)
|
@SpyBean(SimpleExampleService.class)
|
||||||
class SpyBeanOnTestClassForNewBeanIntegrationTests {
|
class SpyBeanOnTestClassForNewBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -37,6 +37,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see SpyBeanOnTestFieldForExistingBeanIntegrationTests
|
* @see SpyBeanOnTestFieldForExistingBeanIntegrationTests
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
|
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
|
||||||
class SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests {
|
class SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2019 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -28,6 +28,8 @@ import org.springframework.context.annotation.Import;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })
|
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })
|
||||||
public class SpyBeanOnTestFieldForExistingBeanConfig {
|
public class SpyBeanOnTestFieldForExistingBeanConfig {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
|
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
|
||||||
class SpyBeanOnTestFieldForExistingBeanIntegrationTests {
|
class SpyBeanOnTestFieldForExistingBeanIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,6 +39,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Andreas Neiser
|
* @author Andreas Neiser
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,6 +33,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingCircularBeansConfig.class)
|
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingCircularBeansConfig.class)
|
||||||
class SpyBeanOnTestFieldForExistingCircularBeansIntegrationTests {
|
class SpyBeanOnTestFieldForExistingCircularBeansIntegrationTests {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,6 +39,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests {
|
class SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnTestFieldForExistingGenericBeanProducedByFactoryBeanIntegrationTests {
|
class SpyBeanOnTestFieldForExistingGenericBeanProducedByFactoryBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2023 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -38,6 +38,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests {
|
class SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanOnTestFieldForNewBeanIntegrationTests {
|
class SpyBeanOnTestFieldForNewBeanIntegrationTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,6 +44,8 @@ import static org.mockito.Mockito.reset;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanWithAopProxyAndNotProxyTargetAwareTests {
|
class SpyBeanWithAopProxyAndNotProxyTargetAwareTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,6 +44,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
* @see <a href="https://github.com/spring-projects/spring-boot/issues/5837">5837</a>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
class SpyBeanWithAopProxyTests {
|
class SpyBeanWithAopProxyTests {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,6 +36,8 @@ import static org.mockito.BDDMockito.then;
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(since = "3.4.0", forRemoval = true)
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
|
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
|
||||||
class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue