You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by splitshade <ma...@googlemail.com> on 2011/10/05 14:18:52 UTC

WicketTester#startComponentInPage and tester#assertModelValue

Hi, 

I have a rather strange behavior, and I don´t know what I´m doing wrong.
Before I open a Bug, I would like to hear some opinions, why this works this
way.

I try the following (in Pseudocode):

tester = new WicketTester();
tester.startComponentInPage(new Label("test","hello");
tester.assertModelValue("test","hello"); --> throws 

java.lang.IllegalArgumentException: Component is not a container and so does
not contain the path test.

Funny as it is, to make this work, you have to do the following assertion:

tester.assertModelValue("", "hello");

The error lies in 
public Component getComponentFromLastRenderedPage(String path,
		final boolean wantVisibleInHierarchy)
in Line: path = startComponent.getId() + ":" + path;

Here i think you would need to check whether startComponent is a
WebMarkupContainer or not, 
I would file a Bug and provide a patch, or am I completely wrong?

Regards

Martin


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-startComponentInPage-and-tester-assertModelValue-tp3874269p3874269.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester#startComponentInPage and tester#assertModelValue

Posted by Martin Grigorov <mg...@apache.org>.
Please create a ticket with a quickstart.
Thanks!

On Wed, Oct 5, 2011 at 6:14 PM, Andrea Del Bene <ad...@ciseonweb.it> wrote:
> Hi,
>
> I agree with you, that's a little ambiguous. Why
> 'getComponentFromLastRenderedPage' uses 'startComponent'? Shouldn't be
> 'path' an absolute path to the component on the page?
>
>> Hi,
>>
>> I have a rather strange behavior, and I don´t know what I´m doing wrong.
>> Before I open a Bug, I would like to hear some opinions, why this works
>> this
>> way.
>>
>> I try the following (in Pseudocode):
>>
>> tester = new WicketTester();
>> tester.startComponentInPage(new Label("test","hello");
>> tester.assertModelValue("test","hello"); -->  throws
>>
>> java.lang.IllegalArgumentException: Component is not a container and so
>> does
>> not contain the path test.
>>
>> Funny as it is, to make this work, you have to do the following assertion:
>>
>> tester.assertModelValue("", "hello");
>>
>> The error lies in
>> public Component getComponentFromLastRenderedPage(String path,
>>                final boolean wantVisibleInHierarchy)
>> in Line: path = startComponent.getId() + ":" + path;
>>
>> Here i think you would need to check whether startComponent is a
>> WebMarkupContainer or not,
>> I would file a Bug and provide a patch, or am I completely wrong?
>>
>> Regards
>>
>> Martin
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/WicketTester-startComponentInPage-and-tester-assertModelValue-tp3874269p3874269.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester#startComponentInPage and tester#assertModelValue

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,

I agree with you, that's a little ambiguous. Why 
'getComponentFromLastRenderedPage' uses 'startComponent'? Shouldn't be 
'path' an absolute path to the component on the page?

> Hi,
>
> I have a rather strange behavior, and I don´t know what I´m doing wrong.
> Before I open a Bug, I would like to hear some opinions, why this works this
> way.
>
> I try the following (in Pseudocode):
>
> tester = new WicketTester();
> tester.startComponentInPage(new Label("test","hello");
> tester.assertModelValue("test","hello"); -->  throws
>
> java.lang.IllegalArgumentException: Component is not a container and so does
> not contain the path test.
>
> Funny as it is, to make this work, you have to do the following assertion:
>
> tester.assertModelValue("", "hello");
>
> The error lies in
> public Component getComponentFromLastRenderedPage(String path,
> 		final boolean wantVisibleInHierarchy)
> in Line: path = startComponent.getId() + ":" + path;
>
> Here i think you would need to check whether startComponent is a
> WebMarkupContainer or not,
> I would file a Bug and provide a patch, or am I completely wrong?
>
> Regards
>
> Martin
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-startComponentInPage-and-tester-assertModelValue-tp3874269p3874269.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester#startComponentInPage and tester#assertModelValue

Posted by splitshade <ma...@googlemail.com>.
https://issues.apache.org/jira/browse/WICKET-4112

I will provide a patch this evening.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-startComponentInPage-and-tester-assertModelValue-tp3874269p3877347.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org