Re: Empy choices durring unit tests with DropDownChoice

2013-06-18 Thread martin.dilger
Dmitriy, Dmitriy...:)

Never ever call getObject() on your LoadableDetachable Model in the
Constructor of your Component (I taught you better!!:)).

Should be:
new DropDownChoice(aWicketId, yourModel,new ChoicesModel(),
myOwnChoicesRenderer) 

Mind the second Parameter, as this is your Model that gets Populated on
Selection, try this.

You should further check whether you service has been called
Mockito.verify(myService).getChoicesList()





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Empy-choices-durring-unit-tests-with-DropDownChoice-tp4659540p4659583.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Empy choices durring unit tests with DropDownChoice

2013-06-18 Thread Dmitriy Neretin
:)) You should better dive into your new project :))

It didn't work... And I don't have any idea why...

The constructor (id, myModel, choicesModel, renderer) didn't work too :))
But the example is too complicated to discuss it here. But it works fine if
I use this:

(id, choisesModel, renderer) and then getConvertedValue (in the overriden
submit of the form above )

Dmitriy

2013/6/18 martin.dilger martin.dil...@googlemail.com

 Dmitriy, Dmitriy...:)

 Never ever call getObject() on your LoadableDetachable Model in the
 Constructor of your Component (I taught you better!!:)).

 Should be:
 new DropDownChoice(aWicketId, yourModel,new ChoicesModel(),
 myOwnChoicesRenderer)

 Mind the second Parameter, as this is your Model that gets Populated on
 Selection, try this.

 You should further check whether you service has been called
 Mockito.verify(myService).getChoicesList()





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Empy-choices-durring-unit-tests-with-DropDownChoice-tp4659540p4659583.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Empy choices durring unit tests with DropDownChoice

2013-06-17 Thread Dmitriy Neretin
Hi everyone!

I have a little problem. When I unit test a wicket panel with a
DropDownChoice I can't get the choices list into dropdown... So, that is
how I use it:

a) ... new DropDownChoice(aWicketId, new ChoicesModel.getObject(),
myOwnChoicesRenderer)

b) The choices Model ist a loadabledetachablemodel. In the load Method a
have a service call, that returns a list of choices:

load(){
   myService.getChoicesList()
}

c) In the unit test itself I start the panel with:

Mockito.when(myService.getChoicesList()).thenReturn(mockedChoicesList)

tester.startComponentInThePage(MyPanel.class)...

and somewhere on the bottom of the test:

tester.getComponentFromLastRenderedPage(dropDownId).getChoices and ...
nothing happens... The mocked choices are away...

Can somebody explain me, what do I wrong?

Regards,
Dmitriy