GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add recipe to simplify AssertJ SequencedCollection assertions by timtebeek · Pull Request #837 · openrewrite/rewrite-testing-frameworks

Conversation

@timtebeek

@timtebeek timtebeek commented Nov 2, 2025

Copy link
Copy Markdown
Member

Summary

  • Adds new SimplifySequencedCollectionAssertions recipe to transform AssertJ assertions on SequencedCollection methods
  • Transforms assertThat(collection.getLast()) → assertThat(collection).last()
  • Transforms assertThat(collection.getFirst()) → assertThat(collection).first()
  • Includes comprehensive test coverage for various scenarios

Test plan

  • Created test class with multiple test cases covering different scenarios
  • Tests verify transformation of both getFirst() and getLast() methods
  • Tests verify behavior with follow-up assertions
  • Tests verify no changes to non-SequencedCollection code
  • Run full test suite once build environment is available

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@timtebeek @claude
Add recipe to simplify AssertJ SequencedCollection assertions
8bffcda
Transforms assertThat(collection.getLast()) to assertThat(collection).last()
and assertThat(collection.getFirst()) to assertThat(collection).first() for
cleaner and more idiomatic AssertJ assertions on SequencedCollections.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@moderne-meeseeks moderne-meeseeks Bot added this to OpenRewrite Nov 2, 2025
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Nov 2, 2025
@timtebeek timtebeek self-assigned this Nov 2, 2025
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Nov 2, 2025
@timtebeek
Merge branch 'main' into assertthat-last
a9fd62d
@timtebeek

timtebeek commented Nov 2, 2025

Copy link
Copy Markdown
Member Author

@rickie any plans to bump error-prone-support up to using Java 21? Because this could have been a relatively straightforward refaster recipe as well otherwise.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timtebeek timtebeek added recipe Recipe request assertj labels Nov 2, 2025
@timtebeek
timtebeek merged commit 345ac0a into main Nov 2, 2025
@timtebeek
timtebeek deleted the assertthat-last branch November 2, 2025 22:50
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Nov 2, 2025
@rickie

rickie commented Nov 3, 2025

Copy link
Copy Markdown

Yes, soon! PicnicSupermarket/error-prone-support#1927

timtebeek reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Stephan202

Stephan202 commented Nov 3, 2025

Copy link
Copy Markdown

Some rules using SequencedCollection are introduced in PicnicSupermarket/error-prone-support#194, but the ones mentioned here would be welcome too!

timtebeek reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mergify Bot added a commit to robfrank/linklift that referenced this pull request Nov 10, 2025
@mergify
chore(deps): bump org.openrewrite.recipe:rewrite-testing-frameworks f…
74e2062
…rom 3.20.0 to 3.21.2 [skip ci]

Bumps [org.openrewrite.recipe:rewrite-testing-frameworks](https://github.com/openrewrite/rewrite-testing-frameworks) from 3.20.0 to 3.21.2.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-testing-frameworks's releases](https://github.com/openrewrite/rewrite-testing-frameworks/releases).*

> v3.21.2
> -------
>
> What's Changed
> --------------
>
> * Depend on rewrite-third-party for the type table entries by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#841](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/841)
>
> **Full Changelog**: <openrewrite/rewrite-testing-frameworks@v3.21.1...v3.21.2>
>
> v3.21.1
> -------
>
> What's Changed
> --------------
>
> * Add JUnit 6 type table entries by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#839](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/839)
>
> **Full Changelog**: <openrewrite/rewrite-testing-frameworks@v3.21.0...v3.21.1>
>
> 3.21.0
> ------
>
> What's Changed
> --------------
>
> * OpenRewrite recipe best practices by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#834](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/834)
> * Gradle 9.2.0 by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#836](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/836)
> * Add recipe to simplify AssertJ SequencedCollection assertions by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#837](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/837)
>
> **Full Changelog**: <openrewrite/rewrite-testing-frameworks@v3.20.0...v3.21.0>


Commits

* [`4a3bf4e`](openrewrite/rewrite-testing-frameworks@4a3bf4e) Depend on rewrite-third-party for the type table entries ([#841](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/841))
* [`111daea`](openrewrite/rewrite-testing-frameworks@111daea) Add JUnit 6 type table entries ([#839](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/839))
* [`91418e6`](openrewrite/rewrite-testing-frameworks@91418e6) OpenRewrite recipe best practices
* [`345ac0a`](openrewrite/rewrite-testing-frameworks@345ac0a) Add recipe to simplify AssertJ SequencedCollection assertions ([#837](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/837))
* [`37e86b7`](openrewrite/rewrite-testing-frameworks@37e86b7) Gradle 9.2.0 ([#836](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/836))
* [`766f6be`](openrewrite/rewrite-testing-frameworks@766f6be) OpenRewrite recipe best practices ([#834](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/834))
* [`e85e34d`](openrewrite/rewrite-testing-frameworks@e85e34d) Clean up leftover calls to TestCase.super()
* [`2bed89d`](openrewrite/rewrite-testing-frameworks@2bed89d) Fix XmlUnit test to no longer break on new minor or patch releases
* See full diff in [compare view](openrewrite/rewrite-testing-frameworks@v3.20.0...v3.21.2)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.openrewrite.recipe:rewrite-testing-frameworks&package-manager=maven&previous-version=3.20.0&new-version=3.21.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@timtebeek timtebeek

Labels

assertj recipe Recipe request

Projects

OpenRewrite
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@timtebeek @rickie @Stephan202
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.