Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: spring-projects/spring-framework
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: sbrannen/spring-framework
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: issues/gh-33925-MockitoBeans
Choose a head ref
  • 2 commits
  • 39 files changed
  • 1 contributor

Commits on Jan 15, 2025

  1. Configuration menu
    Copy the full SHA
    43f13e4 View commit details
    Browse the repository at this point in the history
  2. Support @⁠MockitoBean at the type level on test classes

    Prior to this commit, @⁠MockitoBean could only be declared on fields
    within test classes, which prevented developers from being able to
    easily reuse mock configuration across a test suite.
    
    With this commit, @⁠MockitoBean is now supported at the type level on
    test classes, their superclasses, and interfaces implemented by those
    classes. @⁠MockitoBean is also supported on enclosing classes for
    @⁠Nested test classes, their superclasses, and interfaces implemented
    by those classes, while honoring @⁠NestedTestConfiguration semantics.
    
    In addition, @⁠MockitoBean:
    
    - has a new `types` attribute that can be used to declare the type or
      types to mock when @⁠MockitoBean is declared at the type level
    
    - can be declared as a repeatable annotation at the type level
    
    - can be declared as a meta-annotation on a custom composed annotation
      which can be reused across a test suite (see the @⁠SharedMocks
      example in the reference manual)
    
    To support these new features, this commit also includes the following
    changes.
    
    - The `field` property in BeanOverrideHandler is now @⁠Nullable.
    
    - BeanOverrideProcessor has a new `default` createHandlers() method
      which is invoked when a @⁠BeanOverride annotation is found at the
      type level.
    
    - MockitoBeanOverrideProcessor implements the new createHandlers()
      method.
    
    - The internal findHandlers() method in BeanOverrideHandler has been
      completely overhauled.
    
    - The @⁠MockitoBean and @⁠MockitoSpyBean section of the reference
      manual has been completely overhauled.
    
    Closes gh-33925
    sbrannen committed Jan 15, 2025
    Configuration menu
    Copy the full SHA
    405eb7c View commit details
    Browse the repository at this point in the history
Loading