Skip to content

Add AGENTS.md with AssertJ/JUnit5 test migration guidelines - #3728

Open
nastra wants to merge 1 commit into
apache:masterfrom
nastra:add-agents-file
Open

Add AGENTS.md with AssertJ/JUnit5 test migration guidelines#3728
nastra wants to merge 1 commit into
apache:masterfrom
nastra:add-agents-file

Conversation

@nastra

@nastra nastra commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

This adds guidelines that I've been defining/using for Claude when migrating the entire codebase from JUnit4 to JUnit5 + AssertJ

What changes are included in this PR?

An AGENTS.md file that contains migration guidelines

Are these changes tested?

Are there any user-facing changes?

@nastra

nastra commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

/cc @Fokko @wgtmac

Comment thread AGENTS.md
@dossett

dossett commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I'm glad to see an AGENTS.md file added, this is great. This is a LOT of context about writing unit tests, which is also great. But it might be too much context for the agent to always have, even when doing things not related to unit tests. A pattern I've found very useful is to create some agent-specific documentation in a separate file and add a pointer to that in AGENTS.md. Then the agent always has the context of where to find the information when it needs it.

## Unit tests
When writing, updating, or migrating unit tests please read the reference document [e.g., `./agents/docs/unit-testing.md`]

Something like that

@divjotarora divjotarora left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @nastra!

Comment thread AGENTS.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @dossett that this is likely too much testing-specific info in a top-level AGENTS.md. The suggestion to move it to a separate file that can lazy loaded only when writing tests sounds reasonable. Additionally, we're mixing a lot of information about writing new tests vs. migrating existing ones. Perhaps it would make sense to separate these? Even if all of this info goes into a TESTING_GUIDELINES.md file or something but in separate sections, it would be more readable.

Lastly, there's a few "MUST" rules in here (e.g. every assertThatThrownBy must contain an isInstanceOf chain + msg check). Do we have linter rules for these rather than just putting them in agent guidelines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants