[
https://issues.apache.org/jira/browse/WICKET-6422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083871#comment-16083871
]
Martin Grigorov commented on WICKET-6422:
-----------------------------------------
You should use TagTester to test markup.
> WicketTester should allow for testing wicket:message / Component body
> ---------------------------------------------------------------------
>
> Key: WICKET-6422
> URL: https://issues.apache.org/jira/browse/WICKET-6422
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 8.0.0-M6
> Reporter: Kamil
>
> When I create link like this:
> {code}
> @Override
> protected void onInitialize() {
> super.onInitialize();
> add(new AjaxLink<String>("myButton", Model.of("my.label")) {
> @Override
> public void onClick(final AjaxRequestTarget target) {
> }
> });
> }
> {code}
> I can test label value using:
> {code}
> wicketTester.assertModelValue("myButton", "my.label");
> {code}
> But when I create it like this:
> {code}
> //java:
> add(new AjaxLink<Void>("myButton") {
> @Override
> public void onClick(final AjaxRequestTarget target) {
> }
> });
> //markup:
> <div wicket:id="myButton">
> <wicket:message key="my.label"/>
> </div>
> {code}
> I have no possibility to test it, because:
> 1) assertModelValue is null
> 2) I can not get its child component because messageID is random:
> {code}
> [MessageContainer [Component id = wicket_message411296549]]
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)