Skip to content

test: Migrate flow-polymer-template tests to JUnit 6 (#23625) (CP: 25.1)#23838

Merged
vaadin-bot merged 1 commit into25.1from
cherry-pick-23625-to-25.1-1773236817001
Mar 11, 2026
Merged

test: Migrate flow-polymer-template tests to JUnit 6 (#23625) (CP: 25.1)#23838
vaadin-bot merged 1 commit into25.1from
cherry-pick-23625-to-25.1-1773236817001

Conversation

@vaadin-bot
Copy link
Collaborator

This PR cherry-picks changes from the original PR #23625 to branch 25.1.

Original PR description

No description provided in the original PR.

* refactor: Migrate flow-polymer-template tests to JUnit 5

* fix: address PR review comments for JUnit 5 migration

Move setup code outside assertThrows lambdas so only the
expected-to-throw call remains inside. Restore specific getter/setter
calls in TemplateModelTest NotSupportedModel tests. Remove stale
commented-out @disabled annotation in CompositeTest.

* fix: restore public visibility on bean setters and fix remaining review issues

Bean setter methods in test inner classes need public visibility for
reflection-based access by the template model system. Also make
TemplateModelTest class package-private and move setup code outside
assertThrows lambda in TemplateModelWithEncodersTest.

* fix: assertThrows for twoEventHandlerMethodsWithTheSameName

The exception is thrown during component construction (handler method
validation), not during invokeMethod. Wrap only the constructor call
in assertThrows.

* test: assertThrows lambdas contain only the throwing call in TemplateModelTest

Split NotSupportedModel into two interfaces so that method-signature
tests can construct the template outside assertThrows. The long-type
methods cause eager validation during construction, while invalid
method signatures are validated lazily during proxy invocation.

Also fix TemplateModelProxyHandler.intercept to validate method
signatures before calling getPropertyName, which avoids an
AssertionError from the assert in ReflectTools.getPropertyName.

* fix: defer unsupported type validation to property access time

BeanModelType.getModelType() threw InvalidTemplateModelException
eagerly during template construction for unsupported types like long,
making it impossible to test getter/setter behavior separately.

Introduce UnsupportedModelType that stores the error and defers
throwing to modelToApplication/applicationToModel calls. This allows
tests to construct the template and verify the exception is thrown
when the actual getter or setter is invoked.

* test: revert deferred unsupported type validation, merge primitive tests

Revert BeanModelType and UnsupportedModelType production changes per
reviewer feedback. Merge testUnsupportedPrimitiveSetter and
testUnsupportedPrimitiveGetter into a single testUnsupportedPrimitiveProperty
that asserts on the error message from template construction.

* Revert unnecessary change
@vaadin-bot
Copy link
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR [Message is sent from bot]

@vaadin-bot vaadin-bot enabled auto-merge (squash) March 11, 2026 13:57
@sonarqubecloud
Copy link

@github-actions
Copy link

Test Results

 1 382 files  ±0   1 382 suites  ±0   1h 27m 18s ⏱️ + 1m 45s
 9 892 tests  - 1   9 821 ✅  - 1  71 💤 ±0  0 ❌ ±0 
10 365 runs   - 1  10 285 ✅  - 1  80 💤 ±0  0 ❌ ±0 

Results for commit 9f00f10. ± Comparison against base commit 05cfb06.

@vaadin-bot vaadin-bot merged commit 41f11f7 into 25.1 Mar 11, 2026
30 checks passed
@vaadin-bot vaadin-bot deleted the cherry-pick-23625-to-25.1-1773236817001 branch March 11, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants