You can hide Window behind an interface and use a Mock for your tests

public interface Window {
    boolean confirm(String msg);
}

public class WindowImpl implements Window {
    public boolean confirm(String msg) {
        return com.google.gwt,user.client.Window.confirm(msg);
    }
}

public class MockWindow implements Window {
    private boolean confirmation;

    public void setConfirmation(boolean confirmation) {
        this.confirmation = confirmation;
    }

    public boolean confirm(String msg) {
        return confirmation;
    }
}

On Mon, Apr 18, 2011 at 4:28 PM, Simon LG <simon...@gmail.com> wrote:

> Hi,
>
> I'm trying to return false when Window.confirm(msg) is called in a
> GwtTestCase. It is always returning true by HtmlUnit because it has no
> ConfirmHandlers.
>
> Is there a way to override this function ?
>
> Thanks
>
> Simon
>
> --
> 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.
>
>


-- 
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

-- 
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