Skip to content

Migrate AI Guard tests to JUnit 5#11320

Draft
smola wants to merge 3 commits intomasterfrom
smola/ai-guard-java-tests
Draft

Migrate AI Guard tests to JUnit 5#11320
smola wants to merge 3 commits intomasterfrom
smola/ai-guard-java-tests

Conversation

@smola
Copy link
Copy Markdown
Member

@smola smola commented May 8, 2026

What Does This Do

Migrate AI Guard tests to JUnit 5, except smoke tests that require migrating several base classes.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

smola added 3 commits May 8, 2026 10:31
Convert AIGuardSystemTests.groovy to a Java JUnit 5 test extending
DDJavaSpecification, using WithConfigExtension for env injection. Add
junit5/mockito test deps to the agent-aiguard module and start tracking
the module in .github/g2j-migrated-modules.txt.
Convert the 58-test Spock spec into a JUnit 5 Java test extending
DDJavaSpecification. Use @TableTest for tabular cases (missing keys,
endpoint discovery), @MethodSource for parameterized cases that need
non-tabular data (action/blocking/suite combinations, options,
sds-finding shapes), and Mockito with ArgumentCaptor for the
metaStruct capture pattern previously expressed as Spock closures.
Convert the AI Guard MessageWriter Spock spec to a Java JUnit 5 test
extending DDJavaSpecification, replacing injectSysConfig with the
@WithConfig annotation. The 8 tests cover msgpack serialization of
plain content, tool calls/output, and content parts.
@smola smola added comp: testing Testing tag: no release notes Changes to exclude from release notes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM comp: ai-guard AI Guard labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ai-guard AI Guard comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant