From 0da4ae96b4c3bc61524e4287de28c4f6a22f99d9 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:49:05 +0200 Subject: [PATCH] Rename internal MockitoBeans class to MockBeans This is a prerequisite for gh-33925 which will introduce a public @MockitoBeans container annotation in the same package. --- .../AbstractMockitoBeanOverrideHandler.java | 18 +++++++++--------- .../{MockitoBeans.java => MockBeans.java} | 2 +- .../MockitoResetTestExecutionListener.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) rename spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/{MockitoBeans.java => MockBeans.java} (98%) diff --git a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/AbstractMockitoBeanOverrideHandler.java b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/AbstractMockitoBeanOverrideHandler.java index 3e7b39275fb0..a90980fe66ce 100644 --- a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/AbstractMockitoBeanOverrideHandler.java +++ b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/AbstractMockitoBeanOverrideHandler.java @@ -56,20 +56,20 @@ MockReset getReset() { @Override protected void trackOverrideInstance(Object mock, SingletonBeanRegistry trackingBeanRegistry) { - getMockitoBeans(trackingBeanRegistry).add(mock); + getMockBeans(trackingBeanRegistry).add(mock); } - private static MockitoBeans getMockitoBeans(SingletonBeanRegistry trackingBeanRegistry) { - String beanName = MockitoBeans.class.getName(); - MockitoBeans mockitoBeans = null; + private static MockBeans getMockBeans(SingletonBeanRegistry trackingBeanRegistry) { + String beanName = MockBeans.class.getName(); + MockBeans mockBeans = null; if (trackingBeanRegistry.containsSingleton(beanName)) { - mockitoBeans = (MockitoBeans) trackingBeanRegistry.getSingleton(beanName); + mockBeans = (MockBeans) trackingBeanRegistry.getSingleton(beanName); } - if (mockitoBeans == null) { - mockitoBeans = new MockitoBeans(); - trackingBeanRegistry.registerSingleton(beanName, mockitoBeans); + if (mockBeans == null) { + mockBeans = new MockBeans(); + trackingBeanRegistry.registerSingleton(beanName, mockBeans); } - return mockitoBeans; + return mockBeans; } @Override diff --git a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBeans.java b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockBeans.java similarity index 98% rename from spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBeans.java rename to spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockBeans.java index 1c636f629d29..d57c3fe411a2 100644 --- a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoBeans.java +++ b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockBeans.java @@ -28,7 +28,7 @@ * @author Sam Brannen * @since 6.2 */ -class MockitoBeans { +class MockBeans { private final List beans = new ArrayList<>(); diff --git a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoResetTestExecutionListener.java b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoResetTestExecutionListener.java index f4556a261920..be8504765845 100644 --- a/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoResetTestExecutionListener.java +++ b/spring-test/src/main/java/org/springframework/test/context/bean/override/mockito/MockitoResetTestExecutionListener.java @@ -116,7 +116,7 @@ private static void resetMocks(ConfigurableApplicationContext applicationContext } } try { - beanFactory.getBean(MockitoBeans.class).resetAll(reset); + beanFactory.getBean(MockBeans.class).resetAll(reset); } catch (NoSuchBeanDefinitionException ex) { // Continue