google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

Problem working with UiBinder #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a simple UiBinder widget class and .ui.xml related file.

 * NoopUiBinder.java:

package com.ofertaunica.webapplication.client.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;

public class NoopUiBinder extends Composite {

    private static NoopUiBinderUiBinder uiBinder = GWT
            .create(NoopUiBinderUiBinder.class);

    @UiField
    TextArea field;

    interface NoopUiBinderUiBinder extends UiBinder<Widget, NoopUiBinder> {
    }

    public NoopUiBinder() {
        initWidget(uiBinder.createAndBindUi(this));
    }

}

 * NoopUiBinder.ui.xml:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <ui:style>
    </ui:style>
    <g:HTMLPanel>
        <g:TextArea ui:field="field">Hello World</g:TextArea>
    </g:HTMLPanel>
</ui:UiBinder>

2. Create a simple testcase for this widget, as presented at 
wiki:SimpleUnitTest:

package com.ofertaunica.webapplication.widget;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.octo.gwt.test.AbstractGwtTest;
import com.ofertaunica.webapplication.client.widgets.NoopUiBinder;

public class NoopUiBinderTest extends AbstractGwtTest {

    private NoopUiBinder binder;

    @Before
    public void setUp() {
        binder = new NoopUiBinder();
    }

    @Test
    public void testNotNull() {
        Assert.assertNotNull(binder);
    }

}

3. Run your test and get an Exception
I'm using Eclipse with Google Plugin, so just Run -> Run as ... -> Junit Test

What is the expected output? What do you see instead?
Test pass

What version of the product are you using? On what operating system?
gwt-test-utils 2.2, on Ubuntu 10.04

Please provide any additional information below.

Original issue reported on code.google.com by ronoaldo on 25 Nov 2010 at 1:38

GoogleCodeExporter commented 9 years ago
I forgot to atach the stack trace for the exception I get:

java.lang.ExceptionInInitializerError
    at com.ofertaunica.webapplication.widget.NoopUiBinderTest.setUp(NoopUiBinderTest.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.RuntimeException: No declared GwtCreateHandler has been 
able to create an instance of 
'com.ofertaunica.webapplication.client.widgets.NoopUiBinder$NoopUiBinderUiBinder
'. You should add our own with 'addGwtCreateHandler(..)' method or declared 
your tested object with @Mock
    at com.octo.gwt.test.internal.patcher.GwtPatcher.create(GwtPatcher.java:52)
    at com.google.gwt.core.client.GWT.create(GWT.java)
    at com.ofertaunica.webapplication.client.widgets.NoopUiBinder.<clinit>(NoopUiBinder.java:13)
    ... 24 more

I tried to annotate binder class variable with @Mock, but no success. Also, 
don't found usefull documentation on how to create the  addGwtCreateHandler() 
method.

Any tips?

Original comment by ronoaldo on 25 Nov 2010 at 1:39

GoogleCodeExporter commented 9 years ago
Hi,

Actually, UIBinder is not supported for the moment. We are working on it for 
the next release. A roadmap will be published in the next couple of days.

Original comment by gael.laz...@gmail.com on 29 Nov 2010 at 4:39

GoogleCodeExporter commented 9 years ago
Hi,

do you still plan to add support for UiBinder in next release?
when can I expect next release?

Original comment by pawel.zi...@gmail.com on 16 Feb 2011 at 1:42

GoogleCodeExporter commented 9 years ago
Hi, 
Do you know if the next release will provide support for tus UIBinder's feature?

Regards and thanks for this nice project

Original comment by claude.p...@gmail.com on 16 Feb 2011 at 1:48

GoogleCodeExporter commented 9 years ago
Hi,

This is the list of your priorities :

- ext-GWT integration
- update to GWT 2.2.x
- UiBinder's support

We are currently focused on GXT integration which expect a lot of effort.
Update to GWT 2.2 should be quite easy (no more than 2 days of work)

A degraded version of UiBinder could be integrated in an easy way (only java 
declared widget would be accessed by gwt-test-utils).
A full version of UiBinder integration would be more difficult, since it will 
required to call gwt code generator (XML => java widget) manually.

You are more than welcome if you want to contribute (contact me by mail if you 
want) 

Original comment by gael.laz...@gmail.com on 28 Feb 2011 at 9:49

GoogleCodeExporter commented 9 years ago
The support for UiBinder has been started !

We plan to have UiBinder working for 0.28 version :-)

Original comment by gael.laz...@gmail.com on 12 Apr 2011 at 12:40

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 12 Apr 2011 at 12:40

GoogleCodeExporter commented 9 years ago
UiBinder is now supported, starting gwt-test-utils-0.28 :-)

Original comment by gael.laz...@gmail.com on 10 May 2011 at 10:30