Add WicketTester#executeBehavior(Class) to run a behavior by its type

Open
#1,955 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@aryankalantri is already working on this.

Since Nov 21, 2026.

  • #1978 by @aryankalantri — open

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java

Research direction

Read BaseWicketTester.java beside executeBehavior(AbstractAjaxBehavior) and the listed BaseWicketTesterTest.java tests. Decide whether lookup should take a component and behavior class or search the page, then document the public API with Javadoc and the next release's @since. Done means tests cover clear failures for no match and multiple matches.

Written by the indexing model from the issue text.

Description

good first issue

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:

MyPanel panel = tester.startComponentInPage(new MyPanel());
panel.getBehaviors(AbstractDefaultAjaxBehavior.class).forEach(tester::executeBehavior);

A variant that finds the behavior by type would make this one call.

Where

wicket-tester/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java, next to executeBehavior(AbstractAjaxBehavior). WicketTester is shipped to applications, so this is public API: it needs Javadoc and an @since with the next release.

Done when

  • A method that takes a component and a behavior class is probably more useful than one that searches the whole page; decide which and explain it in the pull request. It fails with a clear message when there is no match or more than one.
  • Tests in wicket-core-tests/src/test/java/org/apache/wicket/util/tester/BaseWicketTesterTest.java.

Background

Originally requested as WICKET-6487.


Part of #1945. This issue is meant for a first contribution to Wicket. To work on it, leave a comment so others know; a claim without a pull request lapses after two weeks. Questions are welcome, here on the issue or on [email protected]. Start your branch from master, and see Send a pull request to Wicket for building and testing.

Dominant language
Java
Stars
800
Forks
437
Avg merge
21h 36m
Merged PRs (30d)
167

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/wicket

All issues in apache/wicket

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.