Skip to content

Add test for @attribute in wrapper-object array form#53

Open
gnodet wants to merge 1 commit into
mainfrom
fix/28-followup
Open

Add test for @attribute in wrapper-object array form#53
gnodet wants to merge 1 commit into
mainfrom
fix/28-followup

Conversation

@gnodet

@gnodet gnodet commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Claude Code on behalf of Guillaume Nodet

Summary

  • Add test coverage for the wrapper-object array form of @attribute handling in buildXmlNode
  • The existing test from Fix @attribute prefix ignored in array elements #52 only covered the regular-object path; this covers the wrapper-object path (where the first field matches the singular name of the parent array)
# wrapper-object form (this test)
transformers:
  - transformer:
      "@implementation": ...
      mainClass: com.example.Main

# vs regular-object form (existing test)
transformers:
  - "@implementation": ...
    mainClass: com.example.Main

Test plan

  • New testBuildPluginConfigAttributesWrapper test passes
  • All 78 tests pass

Summary by CodeRabbit

  • Tests
    • Added coverage for parsing YAML that uses a wrapper around plugin transformer configuration.
    • Included a new sample YAML file to verify Maven plugin settings are read and matched correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bafb4cd0-5f48-4e39-8f2e-6a956d3b0cab

📥 Commits

Reviewing files that changed from the base of the PR and between 27c498e and ccf494e.

📒 Files selected for processing (2)
  • extension/src/test/java/eu/maveniverse/maven/mason/YamlParserTest.java
  • extension/src/test/resources/yaml/build-plugin-config-attributes-wrapper.yaml

📝 Walkthrough

Walkthrough

A new YAML test fixture (build-plugin-config-attributes-wrapper.yaml) is added, configuring maven-shade-plugin with a wrapper-form transformers element containing a ManifestResourceTransformer. A corresponding JUnit test method testBuildPluginConfigAttributesWrapper is added to YamlParserTest to parse this fixture and assert the resulting Model matches expectations.

Changes

Wrapper-form plugin config attribute test

Layer / File(s) Summary
YAML fixture and parser test
extension/src/test/resources/yaml/build-plugin-config-attributes-wrapper.yaml, extension/src/test/java/eu/maveniverse/maven/mason/YamlParserTest.java
New YAML resource defines maven-shade-plugin 3.5.0 with a wrapped transformers list containing ManifestResourceTransformer setting mainClass. The new test method parses this fixture, builds the expected Model, and asserts equality via assertModelEquals.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • maveniverse/mason#52: The wrapper-form YAML parsing behavior tested here (handling @-prefixed attributes inside array/object elements) was fixed in JsonReaderHelper in this prior PR.

Poem

🐇 A wrapper around transformers, neat and bright,
The shade plugin's manifest set just right.
I parsed the YAML with a twitchy nose,
Checked mainClass from my ears down to my toes.
The model matched — the test turned green,
The tidiest fixture a rabbit's ever seen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the new test coverage for @attribute handling in wrapper-object array form.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/28-followup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gnodet

gnodet commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage for @attribute handling when plugin configuration YAML uses the wrapper-object array form (e.g., - transformer: { "@implementation": ... }), ensuring buildXmlNode correctly emits XML attributes in that path as well.

Changes:

  • Added a new YAML fixture that uses the wrapper-object array form for shade plugin transformers.
  • Added a new JUnit test that parses the fixture and asserts the expected XmlNode structure (including the implementation attribute).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
extension/src/test/resources/yaml/build-plugin-config-attributes-wrapper.yaml New YAML fixture exercising wrapper-object array form for @implementation attribute mapping.
extension/src/test/java/eu/maveniverse/maven/mason/YamlParserTest.java New test testBuildPluginConfigAttributesWrapper asserting correct parsing/output for wrapper-object form.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants