• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TAKETODAY / today-infrastructure / 23778768092
85%

Build:
DEFAULT BRANCH: master
Ran 31 Mar 2026 03:41AM UTC
Jobs 1
Files 4790
Run time 6min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

31 Mar 2026 03:17AM UTC coverage: 84.684% (-0.002%) from 84.686%
23778768092

push

github

TAKETODAY
:sparkles: Support @⁠MockitoBean and @⁠MockitoSpyBean on test constructor parameters

Prior to this commit, @⁠MockitoBean and @⁠MockitoSpyBean could be
declared on fields or at the type level (on test classes and test
interfaces), but not on constructor parameters. Consequently, a test
class could not use constructor injection for bean overrides.

To address that, this commit introduces support for @⁠MockitoBean and
@⁠MockitoSpyBean on constructor parameters in JUnit Jupiter test
classes. Specifically, the Bean Override infrastructure has been
overhauled to support constructor parameters as declaration sites and
injection points alongside fields, and the InfraExtension now
recognizes composed @⁠BeanOverride annotations on constructor
parameters in supportsParameter() and resolves them properly in
resolveParameter(). Note, however, that this support has not been
introduced for @⁠TestBean.

For example, the following which uses field injection:

   @⁠JUnitConfig(TestConfig.class)
   class BeanOverrideTests {

      @⁠MockitoBean
      CustomService customService;

      // tests...
   }

Can now be rewritten to use constructor injection:

   @⁠JUnitConfig(TestConfig.class)
   class BeanOverrideTests {

      private final CustomService customService;

      BeanOverrideTests(@⁠MockitoBean CustomService customService) {
         this.customService = customService;
      }

      // tests...
   }

With Kotlin this can be achieved even more succinctly via a compact
constructor declaration:

   @⁠JUnitConfig(TestConfig::class)
   class BeanOverrideTests(@⁠MockitoBean val customService: CustomService) {

      // tests...
   }

Of course, if one is a fan of so-called "test records", that can also
be achieved succinctly with a Java record:

   @⁠JUnitConfig(TestConfig.class)
   record BeanOverrideTests(@⁠MockitoBean CustomService customService) {

      // tests...
   }

63774 of 80547 branches covered (79.18%)

Branch coverage included in aggregate %.

151985 of 174234 relevant lines covered (87.23%)

3.73 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
72.99
-0.95% infra/core/io/buffer/OutputStreamPublisher.java
1
58.24
-0.59% infra/scheduling/concurrent/ThreadPoolTaskScheduler.java
2
73.49
-4.82% infra/jdbc/config/HikariCheckpointRestoreLifecycle.java
2
0.0
0.0% infra/test/context/bean/override/BeanOverrideProcessor.java
2
97.81
-0.28% infra/test/context/junit/jupiter/InfraExtension.java
2
82.26
-8.06% infra/util/concurrent/ListenableFutureTask.java
3
92.91
-1.65% infra/test/context/bean/override/BeanOverrideHandler.java
4
93.16
-3.66% infra/test/context/bean/override/BeanOverrideUtils.java
4
82.61
2.61% infra/test/context/bean/override/mockito/MockitoSpyBeanOverrideHandler.java
4
86.67
-1.96% infra/util/concurrent/AbstractFuture.java
5
93.1
0.57% infra/test/context/bean/override/BeanOverrideBeanFactoryPostProcessor.java
9
71.74
-0.76% infra/test/context/bean/override/mockito/AbstractMockitoBeanOverrideHandler.java
16
72.09
5.86% infra/test/context/bean/override/mockito/MockitoBeanOverrideHandler.java
Subprojects
ID Flag name Job ID Ran Files Coverage
1 /jobs/179562861 23778768092.1 31 Mar 2026 03:41AM UTC 4790
84.68
GitHub Action Run
Source Files on build 23778768092
  • Tree
  • List 4790
  • Changed 21
  • Source Changed 0
  • Coverage Changed 21
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #23778768092
  • 0e3173cf on github
  • Prev Build on master (#23777085178)
  • Next Build on master (#23793344786)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc