Polish "Deprecate @MockBean and @SpyBean"

See gh-39864
This commit is contained in:
Andy Wilkinson
2024-07-12 13:22:28 +01:00
parent 24763940a0
commit cddf92e047
122 changed files with 328 additions and 475 deletions

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -24,10 +24,9 @@ import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.nestedtests.InheritedNestedTestConfigurationTests.ActionPerformer;
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.stereotype.Component;
import org.springframework.test.bean.override.mockito.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import static org.mockito.BDDMockito.then;
import static org.mockito.Mockito.times;

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class AbstractMockBeanOnGenericExtensionTests extends
AbstractMockBeanOnGenericTests<AbstractMockBeanOnGenericTests.ThingImpl, AbstractMockBeanOnGenericTests.SomethingImpl> {

View File

@@ -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");
* 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
* @author Madhura Bhave
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@SpringBootTest(classes = AbstractMockBeanOnGenericTests.TestConfiguration.class)
abstract class AbstractMockBeanOnGenericTests<T extends AbstractMockBeanOnGenericTests.Thing<U>, U extends AbstractMockBeanOnGenericTests.Something> {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class DefinitionsParserTests {
private final DefinitionsParser parser = new DefinitionsParser();
@@ -190,22 +192,26 @@ class DefinitionsParserTests {
return new ArrayList<>(this.parser.getDefinitions());
}
@SuppressWarnings("removal")
@MockBean(ExampleService.class)
static class SingleMockBean {
}
@SuppressWarnings("removal")
@MockBeans({ @MockBean(ExampleService.class), @MockBean(ExampleServiceCaller.class) })
static class RepeatMockBean {
}
@SuppressWarnings("removal")
@MockBean(name = "Name", classes = ExampleService.class, extraInterfaces = ExampleExtraInterface.class,
answer = Answers.RETURNS_SMART_NULLS, serializable = true, reset = MockReset.NONE)
static class MockBeanAttributes {
}
@SuppressWarnings("removal")
@MockBean(ExampleService.class)
static class MockBeanOnClassAndField {
@@ -215,11 +221,13 @@ class DefinitionsParserTests {
}
@SuppressWarnings("removal")
@MockBean({ ExampleService.class, ExampleServiceCaller.class })
static class MockBeanMultipleClasses {
}
@SuppressWarnings("removal")
@MockBean(name = "name", classes = { ExampleService.class, ExampleServiceCaller.class })
static class MockBeanMultipleClassesWithName {
@@ -232,26 +240,31 @@ class DefinitionsParserTests {
}
@SuppressWarnings("removal")
@MockBean
static class MockBeanMissingClassToMock {
}
@SuppressWarnings("removal")
@SpyBean(RealExampleService.class)
static class SingleSpyBean {
}
@SuppressWarnings("removal")
@SpyBeans({ @SpyBean(RealExampleService.class), @SpyBean(ExampleServiceCaller.class) })
static class RepeatSpyBean {
}
@SuppressWarnings("removal")
@SpyBean(name = "Name", classes = RealExampleService.class, reset = MockReset.NONE)
static class SpyBeanAttributes {
}
@SuppressWarnings("removal")
@SpyBean(RealExampleService.class)
static class SpyBeanOnClassAndField {
@@ -261,11 +274,13 @@ class DefinitionsParserTests {
}
@SuppressWarnings("removal")
@SpyBean({ RealExampleService.class, ExampleServiceCaller.class })
static class SpyBeanMultipleClasses {
}
@SuppressWarnings("removal")
@SpyBean(name = "name", classes = { RealExampleService.class, ExampleServiceCaller.class })
static class SpyBeanMultipleClassesWithName {
@@ -278,6 +293,7 @@ class DefinitionsParserTests {
}
@SuppressWarnings("removal")
@SpyBean
static class SpyBeanMissingClassToMock {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockBeanContextCachingTests {
private final DefaultContextCache contextCache = new DefaultContextCache(2);

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanForBeanFactoryIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanOnConfigurationClassForExistingBeanIntegrationTests {
@@ -48,6 +50,7 @@ class MockBeanOnConfigurationClassForExistingBeanIntegrationTests {
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
}
@SuppressWarnings("removal")
@Configuration(proxyBeanMethods = false)
@MockBean(ExampleService.class)
@Import({ ExampleServiceCaller.class, FailingExampleService.class })

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@ExtendWith(SpringExtension.class)
@Deprecated(since = "3.4.0", forRemoval = true)
class MockBeanOnConfigurationClassForNewBeanIntegrationTests {
@Autowired
@@ -47,6 +49,7 @@ class MockBeanOnConfigurationClassForNewBeanIntegrationTests {
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
}
@SuppressWarnings("removal")
@Configuration(proxyBeanMethods = false)
@MockBean(ExampleService.class)
@Import(ExampleServiceCaller.class)

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@ExtendWith(SpringExtension.class)
@Deprecated(since = "3.4.0", forRemoval = true)
class MockBeanOnConfigurationFieldForExistingBeanIntegrationTests {
@Autowired

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@ExtendWith(SpringExtension.class)
@Deprecated(since = "3.4.0", forRemoval = true)
class MockBeanOnConfigurationFieldForNewBeanIntegrationTests {
@Autowired

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
@ContextConfiguration(classes = ChildConfig.class) })

View File

@@ -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");
* 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
* @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)
class MockBeanOnScopedProxyTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@MockBean(ExampleService.class)
class MockBeanOnTestClassForExistingBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@MockBean(ExampleService.class)
class MockBeanOnTestClassForNewBeanIntegrationTests {

View File

@@ -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");
* 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
* @see MockBeanOnTestFieldForExistingBeanIntegrationTests
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
class MockBeanOnTestFieldForExistingBeanCacheIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@Configuration(proxyBeanMethods = false)
@Import({ ExampleServiceCaller.class, FailingExampleService.class })
public class MockBeanOnTestFieldForExistingBeanConfig {

View File

@@ -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");
* 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
* @see MockBeanOnTestFieldForExistingBeanCacheIntegrationTests
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = MockBeanOnTestFieldForExistingBeanConfig.class)
class MockBeanOnTestFieldForExistingBeanIntegrationTests {

View File

@@ -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");
* 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 Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanOnTestFieldForNewBeanIntegrationTests {

View File

@@ -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");
* 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
* @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)
class MockBeanWithAopProxyTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanWithAsyncInterfaceMethodIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanWithGenericsOnTestFieldForNewBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockBeanWithInjectedFieldIntegrationTests {

View File

@@ -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");
* 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
* @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 {
@Rule

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockDefinitionTests {
private static final ResolvableType EXAMPLE_SERVICE_TYPE = ResolvableType.forClass(ExampleService.class);

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockResetTests {
@Test

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockitoContextCustomizerFactoryTests {
private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory();
@@ -60,16 +62,19 @@ class MockitoContextCustomizerFactoryTests {
}
@SuppressWarnings("removal")
@MockBean({ Service1.class, Service2.class })
static class WithMockBeanAnnotation {
}
@SuppressWarnings("removal")
@MockBean({ Service2.class, Service1.class })
static class WithSameMockBeanAnnotation {
}
@SuppressWarnings("removal")
@MockBean({ Service1.class })
static class WithDifferentMockBeanAnnotation {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockitoContextCustomizerTests {
private static final Set<MockDefinition> NO_DEFINITIONS = Collections.emptySet();

View File

@@ -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");
* 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 Madhura Bhave
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class MockitoPostProcessorTests {
@Test

View File

@@ -50,6 +50,8 @@ import static org.mockito.BDDMockito.given;
*
* @author Moritz Halbritter
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class MockitoTestExecutionListenerIntegrationTests {

View File

@@ -42,6 +42,8 @@ import static org.mockito.Mockito.mock;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(MockitoExtension.class)
class MockitoTestExecutionListenerTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(MockitoExtension.class)
class QualifierDefinitionTests {

View File

@@ -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");
* 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 Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@TestMethodOrder(MethodOrderer.MethodName.class)
class ResetMocksTestExecutionListenerTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class SpringBootMockResolverIntegrationTests {
@Test

View File

@@ -30,6 +30,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Moritz Halbritter
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class SpringBootMockResolverTests {
@Test

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests {
@@ -47,6 +49,7 @@ class SpyBeanOnConfigurationClassForExistingBeanIntegrationTests {
then(this.caller.getService()).should().greeting();
}
@SuppressWarnings("removal")
@Configuration(proxyBeanMethods = false)
@SpyBean(SimpleExampleService.class)
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnConfigurationClassForNewBeanIntegrationTests {
@@ -47,6 +49,7 @@ class SpyBeanOnConfigurationClassForNewBeanIntegrationTests {
then(this.caller.getService()).should().greeting();
}
@SuppressWarnings("removal")
@Configuration(proxyBeanMethods = false)
@SpyBean(SimpleExampleService.class)
@Import(ExampleServiceCaller.class)

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnConfigurationFieldForExistingBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnConfigurationFieldForNewBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextHierarchy({ @ContextConfiguration(classes = ParentConfig.class),
@ContextConfiguration(classes = ChildConfig.class) })

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@SpyBean(SimpleExampleService.class)
class SpyBeanOnTestClassForExistingBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@SpyBean(SimpleExampleService.class)
class SpyBeanOnTestClassForNewBeanIntegrationTests {

View File

@@ -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");
* 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
* @see SpyBeanOnTestFieldForExistingBeanIntegrationTests
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
class SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@Configuration(proxyBeanMethods = false)
@Import({ ExampleServiceCaller.class, SimpleExampleService.class })
public class SpyBeanOnTestFieldForExistingBeanConfig {

View File

@@ -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");
* 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
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingBeanConfig.class)
class SpyBeanOnTestFieldForExistingBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = SpyBeanOnTestFieldForExistingCircularBeansConfig.class)
class SpyBeanOnTestFieldForExistingCircularBeansIntegrationTests {

View File

@@ -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");
* 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
* @see SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnTestFieldForExistingGenericBeanIntegrationTests {

View File

@@ -40,6 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnTestFieldForExistingGenericBeanProducedByFactoryBeanIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanOnTestFieldForNewBeanIntegrationTests {

View File

@@ -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");
* 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
* @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)
class SpyBeanWithAopProxyAndNotProxyTargetAwareTests {

View File

@@ -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");
* 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
* @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)
class SpyBeanWithAopProxyTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ import static org.mockito.BDDMockito.then;
*
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanWithJdkProxyTests {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Phillip Webb
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@ExtendWith(SpringExtension.class)
class SpyBeanWithNameOnTestFieldForMultipleExistingBeansTests {

View File

@@ -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");
* 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
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
class SpyDefinitionTests {
private static final ResolvableType REAL_SERVICE_TYPE = ResolvableType.forClass(RealExampleService.class);

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
*
* @author Stephane Nicoll
*/
@Deprecated(since = "3.4.0", forRemoval = true)
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
public @interface CustomQualifier {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@CustomQualifier
public class CustomQualifierExampleService implements ExampleService {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@Deprecated(since = "3.4.0", forRemoval = true)
public interface ExampleExtraInterface {
String doExtra();

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ package org.springframework.boot.test.mock.mockito.example;
* @param <T> the generic type
* @author Phillip Webb
*/
@Deprecated(since = "3.4.0", forRemoval = true)
public interface ExampleGenericService<T> {
T greeting();

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class ExampleGenericServiceCaller {
private final ExampleGenericService<Integer> integerService;

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class ExampleGenericStringServiceCaller {
private final ExampleGenericService<String> stringService;

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@Deprecated(since = "3.4.0", forRemoval = true)
public interface ExampleService {
String greeting();

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class ExampleServiceCaller {
private final ExampleService service;

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ import org.springframework.stereotype.Service;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
@Service
public class FailingExampleService implements ExampleService {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class RealExampleService implements ExampleService {
private final String greeting;

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class SimpleExampleIntegerGenericService implements ExampleGenericService<Integer> {
@Override

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class SimpleExampleService extends RealExampleService {
public SimpleExampleService() {

View File

@@ -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");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ package org.springframework.boot.test.mock.mockito.example;
*
* @author Phillip Webb
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.4.0", forRemoval = true)
public class SimpleExampleStringGenericService implements ExampleGenericService<String> {
private final String greeting;