Thanks Ian. I see your great help to others here. You information
resolved the problem.

Explaining what I was trying to do to others, I am developing a GWT
view using the MVP pattern. It is because a I want to use as minimal
as possible GWTTestCase or GWTTestSuite. They are slow to start run.
So I prefer to use conventional JUnit tests whenever possible.

But there are cases where the only way to test is calling directly the
View. In that cases GWTTestCase and GWTestSuite come to rescue.

What I was trying to do is to ensure that when i click in a button in
the view, the expected delegation to presenter is done. Some code:

* * *
        @Override
        protected void gwtSetUp() throws Exception {
                viewTask = new ViewTask(ObjectMother.getConstantsStub
());
                RootPanel.get().add(viewTask);

        };

        public void
testClickOnInsertShouldCallPresenterPrepareTaskInsert() throws
Exception {
                TaskPresenterMock presenterMock = new TaskPresenterMock
();
                viewTask.setPresenter(presenterMock);
                viewTarefa.insertButton.click();
                assertTrue(presenterMock.isCalledPrepareTaskInsert());
        }
* * *

The code that I was missing was this: RootPanel.get().add(viewTask);

For instance, the tests that use GWTTestCase and Suite I call slow
tests and run with less frequency.

Sorry my English,

Abraços,

Josué.




On May 31, 11:12 pm, Ian Bambury <ianbamb...@gmail.com> wrote:
> Because you haven't added it to the DOM?
> Maybe GWT should throw an error if it's not attached, but it doesn't.
>
> Ian
>
> http://examples.roughian.com
>
> 2009/6/1 Josué <josuesan...@gmail.com>
>
>
>
>
>
> > Hello All,
>
> > The following code is not throwing a RuntimeException. Someone here
> > know why?
>
> > button = new Button("button");
>
> > button.addClickHandler(new ClickHandler(){
> >   �...@override
> >    public void onClick(ClickEvent event) {
> >        throw new RuntimeException(".onClick() not implemented");
> >    }});
>
> > button.click();
> > ...
>
> > My version of GWT is 1.6.4. The one that came with google eclipse
> > plugin for Eclipse.
>
> > Thanks for any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to