Repository navigation
Add WicketTester#executeBehavior(Component, Class) (#1955) - #1978
Open
aryankalantri wants to merge 4 commits into
Open
aryankalantri wants to merge 4 commits into
aryankalantri wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1955.
WicketTester#executeBehavior(AbstractAjaxBehavior)needs the behavior instance. A behavior added inside the tested component is usually not reachable from the test, so the test has to dig it out first:What changed
New overload
executeBehavior(Component, Class<B extends AbstractAjaxBehavior>)inBaseWicketTester.Scope decision (from the issue): the method takes a component and a behavior class, not a page-wide search. A page usually has many behaviors of the same type on different components, so a page-wide search could not pick one. Subtypes of the given type match (
Component#getBehaviors(Class)usesisInstance). The test fails with a clear message when the component has no behavior of the given type, or more than one (in the latter case it tells the caller to execute one of them directly withexecuteBehavior(AbstractAjaxBehavior)).This is new public API, so it has Javadoc and
@since 12.0.0.How tested
New fixture
ExecuteBehaviorTestPanel: its link carries aCountingBehavior(anAjaxEventBehaviorthat increments a counter) added inside the panel, so the test never holds the behavior instance. Three new tests inBaseWicketTesterTest:Results, run locally with a manual
javacbuild (JDK 21):BaseWicketTesterTest14/14 pass (11 pre-existing + 3 new). All 3 new tests fail against unmodifiedmaster(the overload does not exist there), so they exercise the new API.Tests were run locally with a manual
javacbuild because Maven cannot download dependencies in this environment: Java TLS through the egress proxy is reset, whilecurlworks. The fullmvn verifyrun is left to CI as arbiter.