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.39.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: main
Choose a head ref
  • 15 commits
  • 48 files changed
  • 3 contributors

Commits on Jun 20, 2026

  1. TestNgToAssertj: emit a static import for assertThat (#1033)

    Normalize the AssertJ entry points introduced by TestNgToAssertj to a
    static import via UseStaticImport, so qualified Assert.assertX(...) calls
    become static-imported assertThat(...) instead of mirroring the source
    qualification as Assertions.assertThat(...).
    
    Fixes #1029
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    54f3db8 View commit details
    Browse the repository at this point in the history
  2. Add SimplifyHasSizeFromIsEqualToAssertion recipe (#1034)

    Handles literal-first AssertJ size assertions where the meaningful
    expression sits on the isEqualTo(...) side, e.g.
    assertThat(4).isEqualTo(coll.size()) -> assertThat(coll).hasSize(4).
    
    This is the always-safe "Case A" from the issue: the comparison is on a
    primitive int (size()/length()/array length), so reversing the
    assertion is behavior-preserving. Object-equality reversal (Case B) is
    intentionally left untouched since it depends on equals() symmetry.
    
    Fixes #1031
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    9a16f57 View commit details
    Browse the repository at this point in the history
  3. Refactor assertThat(x instanceof Type).isTrue() to assertThat(x).isIn…

    …stanceOf(Type.class) (#1035)
    
    * Add SimplifyAssertJInstanceOfAssertion recipe
    
    Convert `assertThat(x instanceof Type).isTrue()` to the dedicated
    `assertThat(x).isInstanceOf(Type.class)` (and `.isFalse()` / negated
    forms to `isNotInstanceOf`), so failures describe the actual type
    instead of just "expected true but was false".
    
    Handles parenthesized and `!`-negated arguments, qualified and
    statically imported `assertThat`, array types, and skips Java 16+
    pattern bindings whose variable may be used later.
    
    Fixes #1030
    
    * Regenerate recipes.csv for SimplifyAssertJInstanceOfAssertion
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    286a3d7 View commit details
    Browse the repository at this point in the history
  4. Converge AssertJ isSameAs/isNotSameAs(0|1) to isZero/isNotZero/isOne …

    …in a single run (#1036)
    
    The Assertj aggregate normalizes primitive isSameAs/isNotSameAs to
    isEqualTo/isNotEqualTo via Picnic's AssertJPrimitiveRulesRecipes, after
    which our type-specific rules collapse isEqualTo(0) to isZero(), etc.
    Because between-cycle re-attribution does not give the rewritten node a
    typed receiver, the second simplification only fired on a subsequent
    rewriteRun.
    
    Let our type rules also match the isSameAs/isNotSameAs forms directly so
    they collapse straight to isZero/isNotZero/isOne, and order them before
    AssertJPrimitiveRulesRecipes so they win within a single cycle.
    
    Fixes #1032
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    cd8b263 View commit details
    Browse the repository at this point in the history
  5. Simplify AssertJ hasSize(0) to isEmpty() for Iterable (#1037)

    The existing rule targeted java.util.Collection, so an actual typed as
    the broader java.lang.Iterable was not matched. Widen the required type
    to java.lang.Iterable, which subsumes the Collection case.
    
    Fixes #811
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    9e69b1b View commit details
    Browse the repository at this point in the history
  6. Fix isSameAs(null) compile error from null reference comparisons (#1038)

    * Add SimplifyAssertJNullRelatedAssertion to fix isSameAs(null) compile error
    
    assertThat(null == a).isEqualTo(true) was converted by the picnic
    AssertJObjectRulesRecipes into the uncompilable assertThat(null).isSameAs(a),
    since the Refaster rule binds the left operand as the actual value.
    
    This adds a recipe that runs before the picnic rules and converges null
    reference comparisons to the dedicated assertThat(x).isNull()/isNotNull(),
    mirroring SimplifyAssertJInstanceOfAssertion. Only comparisons against the
    null literal are handled; genuine x == y still becomes isSameAs(y).
    
    Fixes #868
    
    * Use J.Literal.isLiteralValue(expr, null) instead of a local helper
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    9a8b7cb View commit details
    Browse the repository at this point in the history
  7. Cover commented AssertJ tests: array length, Comparable & BigDecimal …

    …compareTo (#1039)
    
    * Cover previously-commented AssertJ best-practice tests
    
    Un-comments the disabled cases in AssertJBestPracticesTest and closes the
    coverage gaps they represented:
    
    - Comparable relational operators (>, >=, <, <=) were already handled by
      AssertJPrimitiveRules; the cases were only disabled because the test
      template emitted an invalid `import int;` for primitive types. Fix the
      template to skip imports for primitives and strip array brackets.
    - Add a SimplifyChainedAssertJAssertion entry mapping BigDecimal
      `compareTo(y).isZero()` to `isEqualByComparingTo(y)`.
    - Add SimplifyArrayLengthAssertion to convert `assertThat(array.length)`
      size assertions to dedicated array assertions (isEmpty, hasSize,
      hasSameSizeAs, hasSize{Less,Greater}Than[OrEqualTo]), for both object
      and primitive arrays. Ordered before AssertJNumberRules to avoid the
      `isGreaterThanOrEqualTo(1)` -> `isPositive()` collision.
    
    * Update recipes.csv for new recipe and declarative entries
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    db78ffd View commit details
    Browse the repository at this point in the history
  8. TestsShouldNotBePublic: recognize meta-annotated test methods (#1040)

    Resolve #308 so that classes whose methods carry a custom annotation
    that is itself meta-annotated with @test (e.g. @maventest) also have
    their redundant public modifier removed.
    
    Use AnnotationMatcher's built-in meta-annotation matching rather than
    hand-rolled recursion.
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    7e27ad6 View commit details
    Browse the repository at this point in the history
  9. Add recipe to surface implausible JUnit @timeout values as minutes (#…

    …1041)
    
    Rewrites second-based @timeout values at or above a configurable
    threshold (default 1000s) to the equivalent minutes, e.g.
    @timeout(10000) -> @timeout(value = 167, unit = TimeUnit.MINUTES),
    making likely millisecond mistakes visible. Implements option a) of #452
    and adds it to JupiterBestPractices.
    
    Fixes #452
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    8ade02d View commit details
    Browse the repository at this point in the history
  10. Decompose assertThat(a && b).isTrue() into separate assertions (#1042)

    * Add DecomposeConjunctionAssertion recipe for issue #387
    
    * Add end-to-end issue #387 tests for conjunction decomposition
    
    * Use built-in Expression.unwrap() instead of a custom helper
    
    * Add test showing same-subject conjuncts collapse into a chain
    
    * Flatten conjuncts functionally with ListUtils.flatMap
    
    * Build decomposed assertions with ListUtils.flatMap
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    e471570 View commit details
    Browse the repository at this point in the history
  11. Skip JUnit 4 lifecycle annotation when Jupiter equivalent already pre…

    …sent (#1043)
    
    When a method carries both a JUnit 4 lifecycle annotation (e.g. @before)
    and its Jupiter equivalent (@beforeeach), changing the type of the JUnit 4
    annotation produced a duplicate, non-repeatable annotation. Remove the
    JUnit 4 annotation instead in that case.
    
    Fixes #501
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    0eb4765 View commit details
    Browse the repository at this point in the history
  12. Convert assertThrows with an Executable variable (#1046)

    * Convert `assertThrows` with an `Executable` variable, retyping to `ThrowingCallable`
    
    Fixes #511
    
    * Address review: inline safe via reduce; drop unused import; hoist ThrowingCallable type
    timtebeek authored Jun 20, 2026
    Configuration menu
    Copy the full SHA
    9321cbc View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2026

  1. Recipe best practices

    Use this link to re-run the recipe: https://app.moderne.io/builder/yESIGzVB0?organizationId=QUxML01vZGVybmUgKyBPcGVuUmV3cml0ZQ%3D%3D
    
    Co-authored-by: Moderne <team@moderne.io>
    timtebeek and TeamModerne committed Jun 23, 2026
    Configuration menu
    Copy the full SHA
    cba9383 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    95ff73a View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2026

  1. OpenRewrite recipe best practices

    Co-authored-by: Moderne <team@moderne.io>
    timtebeek and TeamModerne committed Jul 3, 2026
    Configuration menu
    Copy the full SHA
    2e6d485 View commit details
    Browse the repository at this point in the history
Loading