Skip to content

Commit

Permalink
Rename internal MockitoBeans class to MockBeans
Browse files Browse the repository at this point in the history
This is a prerequisite for spring-projectsgh-33925 which will introduce a public
@MockitoBeans container annotation in the same package.
  • Loading branch information
sbrannen committed Jan 3, 2025
1 parent 2ba0022 commit 0da4ae9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @author Sam Brannen
* @since 6.2
*/
class MockitoBeans {
class MockBeans {

private final List<Object> beans = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0da4ae9

Please sign in to comment.