[
https://issues.apache.org/jira/browse/WICKET-6422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083934#comment-16083934
]
Kamil commented on WICKET-6422:
-------------------------------
yes, I can do:
{code}
String markup = page.get("myButton").getMarkup().toString(true);
TagTester tagTester = TagTester.createTagByName(markup , "div");
TagTester child = tagTester.getChild("message");
assertThat(child.getAttribute("key")).isEqualTo("my.message")
{code}
but this way I only check that "wicket:message" is there.
Instead I'd expect that:
{code}
wicketTester.assertMessageValue("myButton", "myTranslatedLabel");
{code}
would test if there realy is translated message
> 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)