Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@maple525866
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fixes #7377

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@YongGoose YongGoose requested a review from Copilot June 8, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds unit tests for the scanner checkers in the seata spring module to ensure that bean scope and package scanning validations behave as expected.

  • Adds tests for ScopeBeansScannerChecker covering scenarios with null bean factory, non-annotated bean definitions, and various scope exclusions.
  • Adds tests for PackageScannerChecker to verify package matching behaviors and case sensitivity.
  • Adds tests for ConfigBeansScannerChecker to validate bean name patterns for configuration classes.

Reviewed Changes

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

File Description
spring/src/test/java/org/apache/seata/spring/annotation/scannercheckers/ScopeBeansScannerCheckerTest.java Unit tests to verify scope exclusion logic and helper methods using reflection
spring/src/test/java/org/apache/seata/spring/annotation/scannercheckers/PackageScannerCheckerTest.java Unit tests covering package scanning and case sensitivity checks
spring/src/test/java/org/apache/seata/spring/annotation/scannercheckers/ConfigBeansScannerCheckerTest.java Parameterized tests and specific cases for validating configuration bean naming

* Helper method to get the EXCLUDE_SCOPE_SET field value
*/
@SuppressWarnings("unchecked")
private Set<String> getExcludeScopeSet() throws Exception {
Copy link

Copilot AI Jun 8, 2025

Choose a reason for hiding this comment

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

Consider refactoring the reflection-based helper methods into a common test utility to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
* Helper method to get the SCANNABLE_PACKAGE_SET field value
*/
@SuppressWarnings("unchecked")
private Set<String> getScannablePackageSet() throws Exception {
Copy link

Copilot AI Jun 8, 2025

Choose a reason for hiding this comment

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

Consider extracting the reflection-based helper methods for field access into a shared utility class for improved maintainability and to reduce duplication across test files.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but not necessary

@codecov
Copy link

codecov bot commented Jun 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.24%. Comparing base (1b2f845) to head (ff18b92).
Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7423      +/-   ##
============================================
+ Coverage     59.10%   59.24%   +0.13%     
  Complexity      531      531              
============================================
  Files          1281     1281              
  Lines         46142    46142              
  Branches       5561     5561              
============================================
+ Hits          27271    27335      +64     
+ Misses        16302    16232      -70     
- Partials       2569     2575       +6     

see 7 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@slievrly slievrly added this to the 2.5.0 milestone Jun 8, 2025
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly merged commit 5f60247 into apache:2.x Jun 8, 2025
9 checks passed
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
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.

add UT for org.apache.seata.spring.annotation.scannercheckers

2 participants