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: openrewrite/rewrite-testing-frameworks
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.28.0
Choose a base ref
...
head repository: openrewrite/rewrite-testing-frameworks
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.29.0
Choose a head ref
  • 7 commits
  • 16 files changed
  • 4 contributors

Commits on Feb 27, 2026

  1. Detect JUnit version in PowerMockitoMockStaticToMockito (#919)

    * Add failing test for JUnit 4 PowerMockito migration
    
    Reproduces moderneinc/customer-requests#1925: when a test class uses
    JUnit 4 (@org.junit.Test), ReplacePowerMockito should use @Before/@after
    instead of @BeforeEach/@AfterEach.
    
    * Detect JUnit version in PowerMockitoMockStaticToMockito
    
    When a test class uses JUnit 4 (@org.junit.Test), the recipe now
    uses @Before/@after from org.junit instead of always defaulting to
    @BeforeEach/@AfterEach from JUnit Jupiter.
    
    Fixes moderneinc/customer-requests#1925
    MBoegers authored Feb 27, 2026
    Configuration menu
    Copy the full SHA
    af19fad View commit details
    Browse the repository at this point in the history
  2. ReplacePowerMockito: ensure mockito-core is added when PowerMock is r…

    …emoved (#920)
    
    * Add failing test for missing mockito-core after PowerMock removal
    
    When a project only has PowerMock declared and gets Mockito transitively
    through powermock-api-mockito, ReplacePowerMockito removes the PowerMock
    dependencies but never adds mockito-core.
    
    Reproduces moderneinc/customer-requests#1926
    
    * Replace PowerMock API dependency with mockito-core instead of just removing it
    
    When a project gets Mockito only transitively through powermock-api-mockito,
    RemoveDependency leaves no Mockito dependency at all. Instead of removing and
    then adding (which runs into stale GradleProject marker issues with
    AddDependency), use ChangeDependency to convert powermock-api-mockito directly
    to mockito-core:3.x.
    
    Handles both powermock-api-mockito (Mockito 1) and powermock-api-mockito2
    (Mockito 2) artifact names.
    
    Fixes moderneinc/customer-requests#1926
    
    * Regenerate recipes.csv
    
    * Add comment explaining mutual exclusivity of powermock-api-mockito artifacts
    MBoegers authored Feb 27, 2026
    Configuration menu
    Copy the full SHA
    0e3d076 View commit details
    Browse the repository at this point in the history

Commits on Feb 28, 2026

  1. Remove all remaining PowerMock dependencies in ReplacePowerMockito re…

    …cipe (#921)
    
    * Remove all remaining PowerMock dependencies in ReplacePowerMockito recipe
    
    The ReplacePowerMockito recipe previously only removed powermock-api-mockito,
    powermock-api-mockito2, and powermock-core. This left behind 14 other
    org.powermock artifacts that should also be removed when migrating to Mockito.
    
    Added RemoveDependency entries for: powermock-api-support,
    powermock-api-mockito-common, powermock-api-easymock, powermock-reflect,
    powermock-module-junit4, powermock-module-junit4-common,
    powermock-module-junit4-legacy, powermock-module-junit4-rule,
    powermock-module-junit4-rule-agent, powermock-module-junit3,
    powermock-module-junit5, powermock-module-testng,
    powermock-classloading-xstream, and powermock-classloading-objenesis.
    
    Fixes moderneinc/customer-requests#1933
    
    * Also remove managed dependencies for PowerMock artifacts
    
    Add RemoveManagedDependency entries alongside each RemoveDependency to
    ensure PowerMock artifacts are also cleaned up from Maven
    dependencyManagement sections.
    
    * Extract PowerMock dependency removal into separate recipe
    
    Move all RemoveDependency and RemoveManagedDependency entries into a new
    RemovePowerMockDependencies declarative recipe for clarity. The main
    ReplacePowerMockito recipe now references it as a single entry.
    
    * Also remove powermock parent POM and powermock-modules aggregator
    
    * Add powermock and powermock-modules to integration test
    
    * Use wildcard to remove all PowerMock dependencies
    
    Replace individual RemoveDependency and RemoveManagedDependency entries
    with a single powermock* glob for each, and inline back into the main
    ReplacePowerMockito recipe.
    
    * Add Maven POM test for managed PowerMock dependency removal
    
    Verifies that RemoveManagedDependency with powermock* wildcard correctly
    removes managed PowerMock dependencies, and that ChangeDependency properly
    converts managed powermock-api-mockito into managed mockito-core.
    
    Fixes moderneinc/customer-requests#1933
    
    * Add Maven POM test to removesAllPowerMockDependencies, remove @issue annotations
    
    Add a pomXml assertion to the existing Gradle test to verify PowerMock
    dependencies are removed from Maven builds without dependencyManagement.
    Remove @issue annotations referencing the customer-requests repo.
    steve-aom-elliott authored Feb 28, 2026
    Configuration menu
    Copy the full SHA
    e8bbdf0 View commit details
    Browse the repository at this point in the history
  2. Add JUnit 4 support to AddMockitoExtensionIfAnnotationsUsed (#1932) (#…

    …922)
    
    When PowerMock's @RunWith(PowerMockRunner.class) is removed from JUnit 4
    tests, mock fields annotated with @mock are never initialized. This adds
    @RunWith(MockitoJUnitRunner.class) for JUnit 4 tests using Mockito
    annotations, complementing the existing JUnit 5 @ExtendWith support.
    bmuschko authored Feb 28, 2026
    Configuration menu
    Copy the full SHA
    63820f4 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2026

  1. Use mockito-inline instead of mockito-core where applicable (#923)

    * ReplacePowerMockito: use mockito-inline instead of mockito-core (#1934)
    
    PowerMock features (static mocking, constructor mocking, final class
    mocking) require the inline mock maker, which is only bundled in
    mockito-inline for Mockito 3.x/4.x. Using mockito-core alone causes
    runtime failures when the migrated code calls Mockito.mockStatic().
    
    * ReplacePowerMockito: conditionally select mockito-core vs mockito-inline (#1934)
    
    Replace hardcoded mockito-inline dependency with a ScanningRecipe that
    detects mockStatic(), whenNew(), or @PrepareForTest usage and selects
    mockito-inline only when needed, falling back to mockito-core otherwise.
    
    * Add ReplacePowerMockDependencies to recipes.csv (#1934)
    
    * ReplacePowerMockDependencies: multi-module project support (#1934)
    
    Use Map<JavaProject, Boolean> in the accumulator so each sub-module
    gets mockito-inline or mockito-core based on its own usage patterns.
    bmuschko authored Mar 2, 2026
    Configuration menu
    Copy the full SHA
    f1b202d View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2026

  1. Add recipe to replace MockitoTestExecutionListener (#924)

    * Add recipe to replace `MockitoTestExecutionListener` with framework-appropriate Mockito initialization
    
    ---------
    
    Co-authored-by: Tim te Beek <[email protected]>
    steve-aom-elliott and timtebeek authored Mar 4, 2026
    Configuration menu
    Copy the full SHA
    5c07d95 View commit details
    Browse the repository at this point in the history
  2. Remove empty constructors and suite() methods in MigrateJUnitTestCase (

    …#926)
    
    After removing `super(testName)`, constructors left with an empty body
    are now fully removed. Static `suite()` methods returning
    `junit.framework.Test` or `TestSuite` are also removed along with their
    stale imports.
    
    Fixes moderneinc/customer-requests#1948
    timtebeek authored Mar 4, 2026
    Configuration menu
    Copy the full SHA
    7796693 View commit details
    Browse the repository at this point in the history
Loading