Coder Social home page Coder Social logo

gwt-test-utils's Introduction

Build Status

In loving memory of Gaël

gwt-test-utils is a Java testing framework for GWT applications. It provides a simple way to write fast Java tests for your GWT client code, without GWTTestCase or any servlet container instance! This means you are able to use any Java tool without restriction: JUnit, reflection, Easymock, Mockito, etc.

Writing tests looks like:

@Test
public void clickOnButtonShouldDisplayMessageInLabel() {
  // Arrange
  SampleView view = new SampleView();
  // ensure the label is not visible at init
  assertThat(view.label).isNotVisible();
  
  // Act: simulate a click event
  Browser.click(view.button);
  
  // Assert: label should be visible and filled
  assertThat(view.label).isVisible().textEquals("The button was clicked!");
}

If you want to write fast tests which will still deal with your GWT view layout and simulate browser events on your widgets easily, you really should consider this framework. The Getting Started page would be a good way to start ;-)

Features

  • GWT code unit testing with small execution time (no hosted mode / browser launched in the background)
  • Simulation for browser's events (click, blur, change, ...)
  • Fluent interface for assertions on widgets, based on assertj
  • Mocks handling using Mockito or EasyMock
  • Standard maven-surefire-plugin support for testing with Maven
  • Support for GWT + Spring application testing
  • Support for GWT + Guice application testing
  • Support for GWT + GIN application testing, with Jukito if wanted
  • Support for JUnitParams
  • Complex use-case testing using CSV-based scenarios
  • Extensibility through the use of custom patchs

Documentation

Whether you want to...

  • Use gwt-test-utils to test your GWT application
  • Make your custom widgets testable with the framework
  • Contribute code

... you'll find everything you need in the wiki.

Roadmap

Here are the features we are working on, ordered by priority (which is not frozen) :

In addition, we are daily improving the existing gwt-test-utils features. To perfect it, we need your feedback !

Community

For any question, feedback or contribution, please contact use through the user group.

You can also follow the day-to-day evolution of the framework and communicate on it through Twitter : #GwtTestUtils

gwt-test-utils's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gwt-test-utils's Issues

GwtPropertiesHelper.getLocalizedProperties() Does Not Follow ResourceBundle Strategy for finding localized files

GwtPropertiesHelper.getLocalizedProperties() only finds an exact match of the locale that you ask for, so if you as for NumberConstantsImpl_en_US.properties, it will return null because GWT doesn't package a NumberConstantsImpl_en_US.properties file. Instead it should match NumberConstantsImpl_en.properties if NumberConstantsImpl_en_US.properties doesn't exist.

See http://docs.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader) for a full explanation of the localized properties matching rules that should be applied here.

To reproduce the problem:

@GwtModule("my.module")
public class MyTest extends GwtTest {

   @Test
   public void myTest() {
   setLocale(new Locale("en","US"));
   NumberFormat.getFormat("0.0");
   // above line throws exception
   }
}

That throws this exception:

java.lang.NullPointerException
    at com.googlecode.gwt.test.internal.patchers.CurrencyListPatcher$CurrencyDataHolder.createCurrencyData(CurrencyListPatcher.java:57)
    at com.googlecode.gwt.test.internal.patchers.CurrencyListPatcher$CurrencyDataHolder.getCurrencyData(CurrencyListPatcher.java:38)
    at com.googlecode.gwt.test.internal.patchers.CurrencyListPatcher.getDefaultJava(CurrencyListPatcher.java:142)
    at com.google.gwt.i18n.client.CurrencyList.getDefaultJava(CurrencyList.java)
    at com.google.gwt.i18n.client.CurrencyList.getDefault(CurrencyList.java:131)
    at com.google.gwt.i18n.client.NumberFormat.getFormat(NumberFormat.java:420)
    at ...

Found unexpected child element, GWT 2.5.1 Gwt-Test-Utils 0.44

com.googlecode.gwt.test.exceptions.GwtTestUiBinderException: Found unexpected child element : urn:import:com.google.gwt.user.client.ui:at in com.google.gwt.user.client.ui.AbsolutePanel
at com.googlecode.gwt.test.uibinder.UiObjectTag.appendElement(UiObjectTag.java:175)
at com.googlecode.gwt.test.uibinder.UiObjectTag.addElement(UiObjectTag.java:62)
at com.googlecode.gwt.test.uibinder.UiTagBuilder.endTag(UiTagBuilder.java:110)
at com.googlecode.gwt.test.uibinder.UiXmlContentHandler.endElement(UiXmlContentHandler.java:41)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLNSDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

Problem with ui:attribute in TextBox

Hello,
I have a problem with my code:

<g:TextBox required="false" ui:field="maxNormText" title="" text="">
    <ui:attribute name="text" key="cm_geometry_maxnorm_title" />
</g:TextBox>

I'am using GWT 2.5.1 and gwt-test-utils 0.45.

Everything works fine when I run application, but runing a test based on gwt-test-utils gives this Exception:
com.googlecode.gwt.test.exceptions.GwtTestUiBinderException: Found unexpected child element : urn:ui:com.google.gwt.uibinder:attribute in com.google.gwt.user.client.ui.TextBox
at com.googlecode.gwt.test.uibinder.UiObjectTag.appendElement(UiObjectTag.java:175)
at com.googlecode.gwt.test.uibinder.UiObjectTag.addElement(UiObjectTag.java:62)
at com.googlecode.gwt.test.uibinder.UiTagBuilder.endTag(UiTagBuilder.java:110)
at com.googlecode.gwt.test.uibinder.UiXmlContentHandler.endElement(UiXmlContentHandler.java:41)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.googlecode.gwt.test.uibinder.UiBinderParser.createUiComponent(UiBinderParser.java:50)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.createAndBindUi(UiBinderInvocationHandler.java:83)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.invoke(UiBinderInvocationHandler.java:34)
at pl.cyfronet.insilicolab.client.ui.wizard.$Proxy53.createAndBindUi(Unknown Source)
at pl.cyfronet.insilicolab.client.ui.wizard.CMGeometryPanel.(CMGeometryPanel.java:34)
at pl.cyfronet.insilicolab.client.ui.wizard.ApplicationInputWizardTest.applicationInputWizard(ApplicationInputWizardTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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)

java.lang.AssertionError: not a Node

Hi,
I get an exception when running my tests:
java.lang.AssertionError: not a Node

the code where it fails is
Util.getJsObject(data);
where
data is an instance of ModelData
this object contains "displayLabel", "label", "value" fields.

when I am renaming these fields all works fine for me.

I am on GWT 2.5.0, GXT 2.2.3 and gwt-test-utils 0.43

Here is a full stack trace of the problem.

java.lang.AssertionError: not a Node
at com.googlecode.gwt.test.internal.utils.JsoUtils.getDomProperties(JsoUtils.java:262)
at com.googlecode.gwt.test.utils.JavaScriptObjects.getJsoProperties(JavaScriptObjects.java:121)
at com.googlecode.gwt.test.utils.JavaScriptObjects.setProperty(JavaScriptObjects.java:99)
at com.googlecode.gwt.test.gxt2.internal.patchers.JsObjectPatcher.set(JsObjectPatcher.java:89)
at com.extjs.gxt.ui.client.js.JsObject.set(JsObject.java)
at com.extjs.gxt.ui.client.js.JsObject.set(JsObject.java:173)
at com.extjs.gxt.ui.client.util.Util.getJsObject(Util.java:152)
at com.extjs.gxt.ui.client.util.Util.getJsObject(Util.java:135)
at com.db.gm.adk.client.widget.multiselect.Multiselect.paintField(Multiselect.java:753)

XML Document.toString and Element.toString returns different string then GWT implementation.

Document.toString for gwt returns that actual xml string. But through gwt-test-util it returns "[object HTMLDocument]"

Element.toString does return the xml but seems to make all the tags lower case.

Created a unit test for both case:
https://github.com/anozaki/GwtErrorExample/blob/master/src/test/java/net/tanoshi/example/shared/test/DocumentTest.java
https://github.com/anozaki/GwtErrorExample/blob/master/src/test/java/net/tanoshi/example/shared/test/DocumentGwtTest.java

Would expect both of these out come to be the same.

Framework not identifying the undeclared UiHandler.

One of my views have an handler as follows -
@UiHandler("myHomePageAnchor")
void onMyHomePageAnchorClick(ClickEvent event) {
listener.onMyHomePageAnchorClicked();
}

Unless "myHomePageAnchor" is declared as an Anchor in my view (current code doesn't have it declared but works fine), the gwt-test-utils fails.

The stack trace in version .41 doesn't give much info and we don't even know the error is due to undeclared UiHandler. But the jar "gwt-test-utils-0.41-20120905.060017-3.jar" I downloaded from sonatype is good with some useful info shed on. i.e., it pinpoints to the view class. See the two different versions throwing different errors.

Stacktrace with 0.41-20120905.060017-3. The last two lines takes me directly to my error class.
java.lang.ExceptionInInitializerError
...<>
Caused by: com.googlecode.gwt.test.exceptions.ReflectionException: Unable to find field, class 'class mypackage.MyViewImpl', fieldName 'myHomePageAnchor'
at com.googlecode.gwt.test.utils.GwtReflectionUtils.getUniqueFieldByName(GwtReflectionUtils.java:692)
at com.googlecode.gwt.test.utils.GwtReflectionUtils.getPrivateFieldValue(GwtReflectionUtils.java:457)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.addHandlers(UiBinderInvocationHandler.java:47)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.createAndBindUi(UiBinderInvocationHandler.java:85)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.invoke(UiBinderInvocationHandler.java:34)
at mypackage.MyViewImpl.$Proxy93.createAndBindUi(Unknown Source)
at mypackage.MyViewImpl.(MyViewImpl.java:40)
... 40 more

Stacktrace with 0.41.

com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating gwt-test-utils prerequisites
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:113)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:299)
at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
... 21 more

This is something I mentioned as an issue 150 @ https://code.google.com/p/gwt-test-utils/issues/detail?id=150. Though I am not looking for the immediate fix, it would be great if the framework throws the error it used to throw earlier. That helps to identify the cause and just declare the troublesome field as a workaround.

Thanks
Shivakumar

@UiField( provided=true) is trouble

In a widget, I had

....
@UiField(provided=true)
Button close;

PeriodPopup()
{
    close = Button.DEFAULT("OK");
    initWidget(uiBinder.createAndBindUi(this));
}

...

gwt-test-utils could not instantiate the widget. The workaround was a change to

@UiField()
Button close;

@UiFactory
Button createButton()
{
return Button.DEFAULT("OK");
}

The exception said that Button had no default constructor and this is true :-). It shouldn't matter however if a field is provided and properly created in the constructor.

Doesn't compile against GWT 2.7

Trying to use the latest released 0.47 version failing for Gerrit Code Review, with

FAIL    <100ms  0 Passed   0 Skipped   1 Failed   com.google.gerrit.client.diff.EditIteratorTest
FAILURE initializationError: com.google.gwt.dev.javac.CompilationStateBuilder.init(Lcom/google/gwt/core/ext/TreeLogger;Ljava/io/File;)V
java.lang.NoSuchMethodError: com.google.gwt.dev.javac.CompilationStateBuilder.init(Lcom/google/gwt/core/ext/TreeLogger;Ljava/io/File;)V
    at com.googlecode.gwt.test.internal.GwtFactory.createCompilationState(GwtFactory.java:156)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:112)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:46)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runner.Computer.getRunner(Computer.java:38)
    at org.junit.runner.Computer$1.runnerForClass(Computer.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:98)
    at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:84)
    at org.junit.runners.Suite.<init>(Suite.java:79)
    at org.junit.runner.Computer.getSuite(Computer.java:26)
    at com.facebook.buck.junit.JUnitRunner.run(JUnitRunner.java:134)
    at com.facebook.buck.junit.Main.main(Main.java:102)

gwt-test-utils + hibernate + gin-persist fails in test with 0.44 (while it didn't in 0.43)

Hi,

I'm using GWT 2.5.0 with GIN 3.0 (persist) and Hibernate 4.2.0.

My test setup worked fine with 0.43 but updating to 0.44 throws an exception while initializing hibernate (org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory).

Does 0.44 do some classloader magic tricks involving dom4j? I see no trace of dependency to dom4j in gwt-test-utils... nor in its dependencies.

Xavier

Class not found after updating gwt-test-utils version

In our project we use gwt, gxt, gwt-test-utils, guice/gin, mockito.

We have several gwt/gxt tests extending com.googlecode.gwt.test.GwtTestWithMockito.
Our modules hierarchy looks like:

  • ModuleA
    • ModuleB inherits ModuleA
      • ModuleC inherits ModuleB
        • TestModule inherits ModuleC

In each module we declared <source/> entries.

When we used:

  • GWT 2.3.0
  • GXT 2.2.5
  • Mockito 1.8.5
  • gwt-test-utils 0.33.4

all tests worked great.

After updating to:

  • GWT 2.5.1
  • GXT 2.2.5 (not changed)
  • Mockito 1.9.5
  • gwt-test-utils 0.44

all tests fail.

...
[GwtTreeLogger]    Compilation unit 'file:*.OurEntryPoint.java' is removed due to invalid reference(s):
[GwtTreeLogger]       (our dependent class from ModuleA)
...
[GwtTreeLogger] Unable to find type '*.OurEntryPoint'
[GwtTreeLogger] Hint: Previous compiler errors may have made this type unavailable
[GwtTreeLogger] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible

(about hint) we have correct entries

Our application still works great in devmode and production mode.

Is there any known problem with gwt-test-utils and our lib versions?

Patcher on gwtbootstrap TabPanel not working

Hello,

I've created a patcher for setHandlerFunctions and set my gwt-test-utils.properties properly.

My patcher :

import com.github.gwtbootstrap.client.ui.TabPanel;
import com.google.gwt.dom.client.Element;

@PatchClass(TabPanel.class)
class TabPanelPatcher {
@PatchMethod
static void setHandlerFunctions(Element e) { }
}

My view :

@UiField
protected TabPanel tabPanel;

public ConsumerDataView(EventBus eventBus) {
    this.eventBus = eventBus;
    tabPanel = new TabPanel(Bootstrap.Tabs.LEFT);
    initWidget(UI_BINDER.createAndBindUi(this));
}

My Test :

public void checkThatPasswordIsEmpty() {
    // GIVEN
    ConsumerDataView view = new ConsumerDataView(eventBus);
    // THEN
    // ASSERT
    assertThat(view.tabPanel.getSelectedTab()).equals(-1);

}

But i've still got this error :
java.lang.UnsatisfiedLinkError: com.github.gwtbootstrap.client.ui.TabPanel.setHandlerFunctions(Lcom/google/gwt/dom/client/Element;)V
at com.github.gwtbootstrap.client.ui.TabPanel.setHandlerFunctions(Native Method)
at com.github.gwtbootstrap.client.ui.TabPanel.(TabPanel.java:214)

Any clues ?

Thanks a lot.

Mocking overlay type defined within your app throws exception.

Mocking JavaScriptObject within your application seems to throw this exception.

However JsDate and other overlay type that are defined in gwt seems to work correctly.

@GwtModule("my.test.Module")
public class MyTest extends GwtTestWithMockito {
   public static class Tester extends JavaScriptObject {
   }

   @Mock
   Tester test;

   @test
   public void testing() {}
}

This test gave me...
com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while defining my.test.client.MyTest$Tester from modified bytecode
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:177)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.junit.runners.model.TestClass.(TestClass.java:44)
at org.junit.runners.ParentRunner.(ParentRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:55)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.(GwtBlockJUnit4ClassRunner.java:20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunnerFactory.newInstance(AbstractGwtRunnerFactory.java:64)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunnerFactory.create(AbstractGwtRunnerFactory.java:42)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:31)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.(JUnit4TestMethodReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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.ClassFormatError: Illegal method name "$" in class/my/test/client/MyTest$Tester
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:173)
... 36 more

Method called from patcher is not visible

Affected version: gwt-test-utils-0.44 gwt-test-utils-gxt2-0.44 (and 43)
GWT version 2.5.1

Test to reproduce:

import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.ToolButton;

public class TestRemoveClassName{
@test
public void test() {
ToolButton toolButton = new ToolButton("aa");
Window window = new Window();
window.add(toolButton);
window.show(); // line 36
}

}

java.lang.AssertionError: No classes for removeClassName(Ljava/lang/String;)V
at com.googlecode.gwt.test.internal.rewrite.OverlayTypesRewriter$MyInstanceMethodOracle.findOriginalDeclaringClass(OverlayTypesRewriter.java:110)
at com.googlecode.gwt.test.internal.rewrite.RewriteRefsToJsoClasses$MyMethodAdapter.visitMethodInsn(RewriteRefsToJsoClasses.java:78)
at com.google.gwt.dev.asm.ClassReader.accept(ClassReader.java:1371)
at com.google.gwt.dev.asm.ClassReader.accept(ClassReader.java:420)
at com.googlecode.gwt.test.internal.rewrite.OverlayTypesRewriter.rewrite(OverlayTypesRewriter.java:578)
at com.googlecode.gwt.test.internal.GwtClassLoader$GwtClassLoaderWithRewriter.findClassBytes(GwtClassLoader.java:100)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:180)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.extjs.gxt.ui.client.core.El.removeStyleName(El.java)
at com.extjs.gxt.ui.client.widget.Component.removeStyleName(Component.java:942)
at com.extjs.gxt.ui.client.widget.button.ToolButton.onRender(ToolButton.java:67)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1023)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:986)
at com.extjs.gxt.ui.client.widget.layout.TableRowLayout.renderComponent(TableRowLayout.java:133)
at com.extjs.gxt.ui.client.widget.Layout.renderAll(Layout.java:352)
at com.extjs.gxt.ui.client.widget.layout.TableRowLayout.onLayout(TableRowLayout.java:125)
at com.extjs.gxt.ui.client.widget.Layout.layout(Layout.java:114)
at com.extjs.gxt.ui.client.widget.Container.doLayout(Container.java:351)
at com.extjs.gxt.ui.client.widget.Container.layout(Container.java:443)
at com.extjs.gxt.ui.client.widget.LayoutContainer.layout(LayoutContainer.java:246)
at com.extjs.gxt.ui.client.widget.Container.layout(Container.java:426)
at com.extjs.gxt.ui.client.widget.LayoutContainer.layout(LayoutContainer.java:241)
at com.extjs.gxt.ui.client.widget.HorizontalPanel.onRender(HorizontalPanel.java:163)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1023)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:986)
at com.extjs.gxt.ui.client.widget.Header.onRender(Header.java:250)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1023)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:986)
at com.extjs.gxt.ui.client.widget.ContentPanel.onRender(ContentPanel.java:1041)
at com.extjs.gxt.ui.client.widget.Window.onRender(Window.java:1243)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1023)
at com.extjs.gxt.ui.client.widget.Component.onAttach(Component.java:1637)
at com.extjs.gxt.ui.client.widget.Container.onAttach(Container.java:470)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:475)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)
at com.extjs.gxt.ui.client.widget.Window.show(Window.java:917)
at TestRemoveClassName.test(TemplateTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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)

Class loader cannot find/method:
"com/google/gwt/dom/client/Element" "removeClassName(Ljava/lang/String;)V"

But this method should not be redefined
It is called from patcher
com.googlecode.gwt.test.gxt2.internal.patchers.ElPatcher;
@PatchMethod
static El removeStyleName(El el, String styleName) {
if (styleName != null) {
Element elem = getWrappedElement(el);
elem.removeClassName(styleName);
}
return el;
}

Throw java.lang.NoSuchMethodError: java.util.List.java_util_List_iterator()Ljava/util/Iterator during running test

If declared class extend JavaScriptObject and implement some interface your framework rewrite this interface

public class Abc<E> extends JavaScriptObject implements List<E>
java.lang.NoSuchMethodError: java.util.List.java_util_List_iterator()Ljava/util/Iterator;
    at org.mockito.internal.configuration.ClassPathLoader.findPluginImplementation(ClassPathLoader.java:110)
    at org.mockito.internal.configuration.ClassPathLoader.findPlatformMockMaker(ClassPathLoader.java:106)
    at org.mockito.internal.configuration.ClassPathLoader.<clinit>(ClassPathLoader.java:59)
    at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:21)
    at org.mockito.internal.MockitoCore.<init>(MockitoCore.java:40)
    at org.mockito.internal.stubbing.defaultanswers.ReturnsMocks.<init>(ReturnsMocks.java:18)
    at org.mockito.Answers.<clinit>(Answers.java:52)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.Class.getEnumConstantsShared(Class.java:2966)
    at java.lang.Class.enumConstantDirectory(Class.java:2987)
    at java.lang.Enum.valueOf(Enum.java:231)
    at sun.reflect.annotation.AnnotationParser.parseEnumValue(AnnotationParser.java:433)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:298)
    at java.lang.reflect.Method.getDefaultValue(Method.java:726)
    at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:117)
    at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:84)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:221)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
    at java.lang.reflect.Field.declaredAnnotations(Field.java:1033)
    at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:1026)
    at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:196)
    at org.junit.runners.model.FrameworkField.getAnnotations(FrameworkField.java:21)
    at org.junit.runners.model.TestClass.addToAnnotationLists(TestClass.java:46)
    at org.junit.runners.model.TestClass.<init>(TestClass.java:41)
    at org.junit.runners.ParentRunner.<init>(ParentRunner.java:65)
    at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:59)
    at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.<init>(GwtBlockJUnit4ClassRunner.java:20)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunnerFactory.newInstance(AbstractGwtRunnerFactory.java:64)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunnerFactory.create(AbstractGwtRunnerFactory.java:42)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:31)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:44)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Calling getClass() on a JavascriptObject throws NullpointerException.

Found in GWT Release (e.g. 2.4.0, 2.5.1, trunk):

2.5.0

Encountered on OS / Browser (e.g. WinXP, IE9, FF10):

Using gwt-test-utils without a browser

Detailed description (please be as specific as possible):

Calling getClass() on a JavascriptObject throws NullpointerException.
The second setter cannot be invoked.

Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):

public class LineCharacter extends JavaScriptObject {
public static LineCharacter create(int line, int ch) {
LineCharacter lineCh = createObject().cast();
return lineCh.setLine(line).setCh(ch); // The setter eventually invokes getClass() in GwtReflectionUtils.getPrivateFieldValue.
}

public final native LineCharacter setLine(int line) /-{
this.line = line; return this;
}-
/;

public final native LineCharacter setCh(int ch) /-{
this.ch = ch; return this;
}-
/;
}

Stack trace:
java.lang.NullPointerException
at com.googlecode.gwt.test.utils.GwtReflectionUtils.getPrivateFieldValue(GwtReflectionUtils.java:457)
at com.googlecode.gwt.test.utils.JavaScriptObjects.getJsoProperties(JavaScriptObjects.java:107)
at com.googlecode.gwt.test.utils.JavaScriptObjects.getJsoProperties(JavaScriptObjects.java:123)
at com.googlecode.gwt.test.utils.JavaScriptObjects.getObject(JavaScriptObjects.java:55)
at net.codemirror.lib.LineCharacter$.setCh$(LineCharacter.java)
at net.codemirror.lib.LineCharacter$.create(LineCharacter.java:23)
...
Workaround if you have one:

Current workaround is to change the return type of the setters to "void", i.e.:
lineCh.setLine(line);
lineCh.setCh(ch);
return lineCh;

works. But this is not optimal.

Unexpected internal compiler error when doing gwt compile in maven with gwt-test-utils 0.44

I have this pom for one project


4.0.0

org.drumtoolkit
drum
1.0-SNAPSHOT
pom

Drum
http://maven.apache.org

UTF-8 ../shared-utils ../server-utils ../dto ../push ../core ../browser
<plugins>

  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.0</version>
    <configuration>
      <source>1.6</source>
      <target>1.6</target>
    </configuration>
  </plugin>


  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <executions>
      <execution>
        <goals>
          <goal>test-jar</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

</plugins>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>



<dependency>
    <groupId>com.googlecode.gwt-test-utils</groupId>
    <artifactId>gwt-test-utils</artifactId>
    <version>0.44</version>
</dependency>

and another pom for a project that uses the above project like this


4.0.0
org.drumtoolkit
monitor-example
war
1.0-SNAPSHOT
monitor example

2.5.1 PRETTY 1.8.3 ${user.home}/.m2/repository/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version} 1 objectify-appengine http://objectify-appengine.googlecode.com/svn/maven gwt-staging https://oss.sonatype.org/content/repositories/comgoogle-141/ junit junit 4.8.1 test
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.5</version>
  <scope>provided</scope>
</dependency>



<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-api-1.0-sdk</artifactId>
  <version>${gae.version}</version>
</dependency>


<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-testing</artifactId>
  <version>${gae.version}</version>
  <scope>test</scope>
</dependency>


<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-api-stubs</artifactId>
  <version>${gae.version}</version>
  <scope>test</scope>
</dependency>


<dependency>
  <groupId>com.google.appengine</groupId>
  <artifactId>appengine-api-labs</artifactId>
  <version>${gae.version}</version>
</dependency>



<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <version>${gwt.version}</version>
  <scope>provided</scope>
</dependency>



<dependency>
  <groupId>com.googlecode.objectify</groupId>
  <artifactId>objectify</artifactId>
  <version>2.2.3</version>
</dependency>


<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.6.1</version>
</dependency>


<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.6.1</version>
</dependency>



<dependency>
  <groupId>org.drumtoolkit</groupId>
  <artifactId>browser</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>


<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
  <classifier>sources</classifier>
  <scope>test</scope>
</dependency>
org.apache.maven.plugins maven-compiler-plugin 2.1 1.6 1.6 -proc:none
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
  </plugin>


  <!-- Copy static web files before executing gwt:run -->
  <plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.4.2</version>
    <executions>
      <execution>
        <phase>compile</phase>
        <goals>
          <goal>copy-resources</goal>
        </goals>
        <configuration>
          <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
          <resources>
            <resource>
              <directory>src/main/webapp</directory>
            </resource>
          </resources>
        </configuration>
      </execution>
    </executions>
  </plugin>


  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-5</version>
    <configuration>
      <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
    </configuration>
  </plugin>


  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.5</version>
  </plugin>


  <!-- IDE -->
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <configuration>
      <downloadSources>true</downloadSources>
      <downloadJavadocs>true</downloadJavadocs>
      <wtpversion>2.0</wtpversion>
      <additionalBuildcommands>
        <buildCommand>
          <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
        </buildCommand>
      </additionalBuildcommands>
      <additionalProjectnatures>
        <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
        <projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
      </additionalProjectnatures>
    </configuration>
  </plugin>


  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0</version>
  </plugin>





  <plugin>
    <groupId>net.kindleit</groupId>
    <artifactId>maven-gae-plugin</artifactId>
    <version>0.8.1</version>
    <executions>
      <execution>
        <id />
        <phase>validate</phase>
        <goals>
          <goal>unpack</goal>
        </goals>
      </execution>
    </executions>
  </plugin>


  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.5.1</version>

    <dependencies>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwt.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>${gwt.version}</version>
      </dependency>
    </dependencies>

    <configuration>
      <logLevel>INFO</logLevel>
      <style>${gwt.style}</style>
      <runTarget>/index.jsp</runTarget>
      <appEngineVersion>${gae.version}</appEngineVersion>
      <appEngineHome>${gae.home}</appEngineHome>
      <server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
      <copyWebapp>true</copyWebapp>
    </configuration>

    <executions>
      <execution>
        <id>gwtcompile</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
  </plugin>





  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9.1</version>
    <executions>
      <execution>
        <id>attach-javadocs</id>
        <goals>
          <goal>jar</goal>
        </goals>
        <configuration>
          <sourcepath>${project.build.sourceDirectory}</sourcepath>
        </configuration>
      </execution>
    </executions>
  </plugin>

  <plugin>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
      <goals>gae:deploy</goals>
    </configuration>
  </plugin>



  <plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${gae.version}</version>
  </plugin>





</plugins>

<pluginManagement>
  <plugins>
    <!--This plugin's configuration is used to store Eclipse m2e settings 
      only. It has no influence on the Maven build itself. -->
    <plugin>
      <groupId>org.eclipse.m2e</groupId>
      <artifactId>lifecycle-mapping</artifactId>
      <version>1.0.0</version>

      <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <versionRange>[2.0.5,)</versionRange>
                <goals>
                  <goal>process</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <execute />
              </action>
            </pluginExecution>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>net.kindleit</groupId>
                <artifactId>maven-gae-plugin</artifactId>
                <versionRange>[0.7.3,)</versionRange>
                <goals>
                  <goal>unpack</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <execute />
              </action>
            </pluginExecution>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <versionRange>[1.2,)</versionRange>
                <goals>
                  <goal>exec</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <execute />
              </action>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<!-- We can configure our integration server to activate this profile 
  and perform gae:deploy, thus uploading latest snapshot to the http://1.latest.<applicationName>.appspot.com 
  automatically -->
<profile>
  <id>integration-build</id>
  <properties>
    <gae.application.version>stage</gae.application.version>
    <!-- Produce pretty JS during GWT compilation for test environment -->
    <gwt.style>DETAILED</gwt.style>
  </properties>
</profile>

<!-- This profile will activate automatically during release and upload 
  application to the http://2.latest.<applicationName>.appspot.com (We might 
  want to set the 2nd version as our applications Default version to be accessible 
  at http://<applicationName>.appspot.com) -->
<profile>
  <id>release-build</id>
  <activation>
    <property>
      <name>performRelease</name>
      <value>true</value>
    </property>
  </activation>

  <properties>
    <!-- During release, set application version in appengine-web.xml 
      to 2 -->
    <gae.application.version>release</gae.application.version>
    <!-- Produce compressed JS during GWT compilation for production 
      environment -->
    <gwt.style>OBFUSCATED</gwt.style>
  </properties>
</profile>

And when I try to build it and it does a gwt compile I get this

[INFO] --- gwt-maven-plugin:2.5.1:compile (gwtcompile) @ monitor-example ---
[INFO] auto discovered modules [com.drum.monitor.monitor, com.drum.minesweeper.minesweeper]
[WARNING] Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
[INFO] Compiling module com.drum.monitor.monitor
[INFO] Validating units:
[INFO] Ignored 81 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] Computing all possible rebind results for 'com.google.gwt.useragent.client.UserAgentAsserter'
[INFO] Rebinding com.google.gwt.useragent.client.UserAgentAsserter
[INFO] Checking rule
[INFO] [WARN] Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'. Are validation-api-.jar and validation-api--sources.jar on the classpath?
[INFO] Specify -logLevel DEBUG to see all errors.
[INFO] [WARN] Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule
[INFO] [ERROR] Unexpected internal compiler error
[INFO] java.lang.RuntimeException: Unexpected IOException on in-memory stream
[INFO] at com.google.gwt.dev.javac.CompilationUnit.getTypes(CompilationUnit.java:324)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.assimilateUnit(UnifyAst.java:672)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeByBinary(UnifyAst.java:970)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.translate(UnifyAst.java:1033)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.translate(UnifyAst.java:1024)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.resolveType(UnifyAst.java:940)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.assimilateUnit(UnifyAst.java:678)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeBySource(UnifyAst.java:985)
[INFO] at com.google.gwt.dev.jjs.impl.UnifyAst.addRootTypes(UnifyAst.java:530)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:621)
[INFO] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:278)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:229)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:141)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:232)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:198)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[INFO] Caused by: java.io.InvalidClassException: com.google.gwt.dev.jjs.ast.JDeclaredType; local class incompatible: stream classdesc serialVersionUID = -8155793964565947646, local class serialVersionUID = -1052417216019896795
[INFO] at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:560)
[INFO] at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
[INFO] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
[INFO] at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
[INFO] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
[INFO] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
[INFO] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
[INFO] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
[INFO] at java.util.ArrayList.readObject(ArrayList.java:593)
[INFO] at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[INFO] at java.lang.reflect.Method.invoke(Method.java:597)
[INFO] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:969)
[INFO] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
[INFO] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
[INFO] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
[INFO] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
[INFO] at com.google.gwt.dev.jjs.ast.JProgram.deserializeTypes(JProgram.java:203)
[INFO] at com.google.gwt.dev.javac.CompilationUnit.getTypes(CompilationUnit.java:322)
[INFO] ... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.335s
[INFO] Finished at: Wed Sep 04 21:37:40 BST 2013
[INFO] Final Memory: 26M/217M

If I remove the dependency on gwt-test-utils the error goes away

$ mvn --version
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 03:15:32+0100)
Maven home: C:\apps\apache-maven-3.1.0
Java version: 1.6.0_37, vendor: Sun Microsystems Inc.
Java home: C:\apps\Java\jdk1.6.0_37\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Any ideas?

Van

Starting an embedded Jetty from within the test fails due to classloader issues

We use some test that require Jetty to run, other tests start and stop (=reset) the Jetty appropriately. Now wen want to add some tests based on GwtTest and start/stop Jetty in the @BeforeClass of them. However, since the magic classloader is already active, poor Jetty cannot start. I tried to add 'org.mortbay.jetty=scan-package' to the gwt-test-utils.properties, but it didn't help. I also tried to play with unbindClassloader/bindClassloader, but no success.

I don't have much knowledge about classloaders, so I don't know what a clean way forward would be here. I would either like to launch Jetty before the magic classloader is active (and stop it after its gone) or make the magic classloader so powerful that it works even with Jetty. Actually, the problem is Jetty trying to load a ResourceBundle to instantiate its MimeType class.

Who has an idea how to proceed?

GWT UNIT TEST- GWT-TEST-UTILS

Hi,

I am new to GWT concept.Now I am working on Unit test cases for GWT- Client side for button action events. Whenever i'm trying to run the test cases i have found an issue like Initialization error. i.e.,
java.lang.NoSuchMethodError: com.google.gwt.dev.javac.CompilationStateBuilder.init(Lcom/google/gwt/core/ext/TreeLogger;Ljava/io/File;)V
at com.googlecode.gwt.test.internal.GwtFactory.createCompilationState(GwtFactory.java:156)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:112)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:46)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)

I have used GWT -2.6.0 version and gwt-test-utils-0.47.

Please provide your valuable Solutions.

Thanks in Advance

gwt-test-utils: JSO Patcher, can't get it to work

I have some JSNI code that I would like to Unit test, so I decided to use gwt-test-utils' Patcher but for some reason it's not working...

I have followed and double checked my code and I can't get it to work.. I have a feeling that it's something very silly I'm forgetting, can anyone spot the problem?

Test:

@GwtModule("com.my.app.gwt.client.view.MyView")
public class MyViewTest extends GwtTest {

private MyView mView;

@Before
public void setUp() {
    mView = new MyView(Mockito.mock(MyView.Binder.class));
}

@Test
public void shouldGetMyConfigAndParse() {
    MyConfig oMyConfig = mView.getMyConfig();
    System.out.println("########## oMyConfig=" + oMyConfig);
    assertTrue(true);
}

}

View:

public class MyView extends ViewImpl implements MyPresenter.MyView {

interface Binder extends UiBinder<Widget, MyView> {
}

@UiField SimplePanel mMainPanel;

@Inject
public MyView(Binder pBinder) {
    initWidget(pBinder.createAndBindUi(this));
}

@Override
public void setInSlot(Object pSlot, IsWidget pContent) {
    if (pSlot == MyPresenter.SLOT_MAIN) mMainPanel.setWidget(pContent);
    else super.setInSlot(pSlot, pContent);
}

@Override
public MyConfig getMyConfig() {
    JSOMyConfig oJSOConfig = getJSOMyConfig();
    MyConfig oConfig = new MyConfig();
    oConfig.setAutoPlay(oJSOConfig.isAutoPlay());
    oConfig.setWidth(oJSOConfig.getWidth());
    oConfig.setHeight(oJSOConfig.getHeight());
    return oConfig;
}

private native JSOMyConfig getJSOMyConfig()/*-{
    return $wnd.myConfig;
}-*/;

}

JSO

public class JSOMyConfig extends JavaScriptObject {

protected JSOMyConfig() { }

public native boolean isAutoPlay() /*-{ 
    return this.autoPlay;
}-*/;

public native String getWidth() /*-{ 
    return this.width;
}-*/;

public native String getHeight() /*-{ 
    return this.height;
}-*/;

}

JSOPatcher

@PatchClass(JSOMyConfig.class)
public class JSOMyConfigPatcher {

@PatchMethod
public static boolean isAutoPlay(JSOMyConfig JSOMyConfig) {
    return false;
}

@PatchMethod
public static String getWidth(JSOMyConfig JSOMyConfig) {
    return "500";
}

@PatchMethod
public static String getHeight(JSOMyConfig JSOMyConfig) {
    return "400";
}

}

META-INF/gwt-test-utils.properties:

com.my.app.gwt.client.config.model.jso = scan-package
com.my.app.gwt.client.view.MyView = gwt-module

Did I miss anything?

error using gwt-test-utils 0.45 and mockito 1.85 in gwt-2.5.1

I try to use gwt-test-utils 0.45 with gwt-2.5.1 and mockito 1.8.5 and this error appear in a simple test case

java.lang.NoClassDefFoundError: org/mockito/internal/configuration/FieldAnnotationProcessor
at org.mockito.configuration.AnnotationEngineHolder.(AnnotationEngineHolder.java:6)
at com.googlecode.gwt.test.GwtTestWithMockito.(GwtTestWithMockito.java:38)
at com.smartmatic.sge.gwt.client.ui.widgets.ticketBrowsing.TicketBrowsingTestRcp.(TicketBrowsingTestRcp.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:209)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:258)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:255)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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.ClassNotFoundException: org.mockito.internal.configuration.FieldAnnotationProcessor
at com.googlecode.gwt.test.internal.GwtClassLoader.findClassBytes(GwtClassLoader.java:230)
at com.googlecode.gwt.test.internal.GwtClassLoader$GwtClassLoaderWithRewriter.findClassBytes(GwtClassLoader.java:97)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:180)
at javassist.Loader.loadClass(Loader.java:311)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 30 more

the test fail when GwtTestWithMockito class is starting

public GwtTestWithMockito() {
AnnotationEngineHolder.setAnnotationEngine(getCustomAnnotationEngine());
}

Using Cobertura or eCobertura (eclipse plugin) with gwt-test-utils

I don't know if this is possible: I want the code coverage of my project with eCobertura, for all the JUnit tests : those which run with gwt-test-utils and the others.

I get the following exceptions:
com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while creating instance of 'com.app.webapp.util.client.IconCellUrl$Template' through 'com.googlecode.gwt.test.internal.handlers.GeneratorCreateHandler' instance
at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.create(GwtTestGWTBridge.java:108)
at com.google.gwt.core.shared.GWT.create(GWT.java:57)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at com.app.webapp.util.client.IconCellUrl.(IconCellUrl.java:115)
at com.app.webapp.util.client.IconCellUrl.(IconCellUrl.java:101)
....

I tries to play with the way classes are loaded, unsuccessfully. Maybe the way Cobertura works is incompatible with the code modifications performed by gwt-test-utils ?

Has anybody tried to do so and succeeded ?

Thanks,

Mathieu

New version

@Gael
seems like we have problem with old mvn version of parent pom in repo.

Our build tool has problem with
java.lang.NoClassDefFoundError: com/google/gwt/core/ext/typeinfo/TypeOracle

when I build locally new SNAPSHOT problem disappear.

Could you change that ?

Error while generating gwt-test-utils prerequisites

hi, recently i made a migration to gwt 2.5.1 and gwt-test-utils 0.44 but when i run test cases that worked in gwt 2.1 appear the following error in console

com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating gwt-test-utils prerequisites
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:113)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDef.checkForSeedTypes(ModuleDef.java:580)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:376)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:367)
at com.googlecode.gwt.test.internal.GwtFactory.createCompilationState(GwtFactory.java:151)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:106)
... 21 more

UnsatisfiedLinkError on FormPanelImpl.submit()

Hi,
I am using GWT 2.5 with GWT-Boostrap 2.2.1.0-SNAPSHOT.gwt-test-util version is 0.44-SNAPSHOT

I have a WellForm element comprising of username and password.
When I try to submit the form using Browser.submit(), it throws an error that the WellForm cannot be convert to FormPanel(which I think is an issue).
Also if I get the loginForm instance and then explicitly call submit() method, I get the following error.

java.lang.UnsatisfiedLinkError: com.google.gwt.user.client.ui.impl.FormPanelImpl.submit(Lcom/google/gwt/dom/client/Element;Lcom/google/gwt/dom/client/Element;)V

It initially seemed that the submit() method is not defined in the FormPanelImplPatched.java. I added the same and re-compiled the code. But am facing the same issue.

Other than adding the method to the PatchClass, is there anyother method to solve the issue.

UiBinder: unexpected child element when ui:text is wrapped with g:Label

If have following code on my page:
<g:Label>
<ui:text from='{msg.topicViewTaskTitle}' />
</g:Label>

I get following error when I run a test:
com.googlecode.gwt.test.exceptions.GwtTestUiBinderException: Found unexpected child element : urn:ui:com.google.gwt.uibinder:text in com.google.gwt.user.client.ui.Label
at com.googlecode.gwt.test.uibinder.UiObjectTag.appendElement(UiObjectTag.java:175)
at com.googlecode.gwt.test.uibinder.UiObjectTag.addElement(UiObjectTag.java:62)
at com.googlecode.gwt.test.uibinder.UiTagBuilder.endTag(UiTagBuilder.java:109)
at com.googlecode.gwt.test.uibinder.UiXmlContentHandler.endElement(UiXmlContentHandler.java:41)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.googlecode.gwt.test.uibinder.UiBinderParser.createUiComponent(UiBinderParser.java:50)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.createAndBindUi(UiBinderInvocationHandler.java:83)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.invoke(UiBinderInvocationHandler.java:34)
at org.ssg.gui.client.topic.view.$Proxy41.createAndBindUi(Unknown Source)
at org.ssg.gui.client.topic.view.TaskListView.(TaskListView.java:35)
at org.ssg.gui.client.topic.view.TaskListViewTest.setUp(TaskListViewTest.java:25)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
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)

RequestPatcher for custom patching

Hi , i am trying to patch com.google.gwt.http.client.Request

@PatchClass(Request.class)
public class RequestPatcher {

@PatchMethod
private static String getBrowserSpecificFailure(XMLHttpRequest xhr) {
    return null ;
}

}

But i always get ,
java.lang.NoClassDefFoundError: com/google/gwt/http/client/Request
at com.google.gwt.http.client.RequestBuilder.doSend(RequestBuilder.java:388)
at com.google.gwt.http.client.RequestBuilder.sendRequest(RequestBuilder.java:256)

The steps i did seems right in the document , so what am i missing here ?

NullPointer exception on GwtFactory.get()

Hello,
We are trying to setup gwt-test-utils for GWT 2.5.0. We have one module that is setup to be tested under src/test/resources/META-INF/gwt-test-utils.properties
com.dynamojack.gwt.dj = gwt-module

Here it the test class:
@GwtModule("com.dynamojack.gwt.dj")
public class LoginComponentTest extends GwtTest {

@Test
public void testLoginSuccess() {

}

}

When I try to run it with JUnit I get the following exception.

java.lang.NullPointerException
at com.googlecode.gwt.test.GwtTest.bindClassLoader(GwtTest.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
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)

java.lang.NullPointerException
at com.googlecode.gwt.test.GwtTest.unbindClassLoader(GwtTest.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runAfters(BeforeAndAfterRunner.java:65)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:37)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
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)

Bug in DeferredReplaceWithCreateHandler

// tee fix: string.equals( class ) is always false. Probably the intention was
// to compare classnames.

See fix at the end of method:

public Object create(final Class<?> classLiteral) throws Exception
{

    String moduleName = GwtConfig.get().getTestedModuleName();

    List<ReplaceWithData> replaceWithList = ModuleData.get(moduleName).getReplaceWithListMap()
            .get(classLiteral.getName().replaceAll("\\$", "."));

    // not handled by a <replace-with> element in any .gwt.xml file
    if (replaceWithList == null)
    {
        return null;
    }

    String replaceWith = getReplaceWithClass(replaceWithList);
    // tee fix: string.equals( class ) is always false. Probably the intention was
    // to compare classnames.
    // 
    //        return ((replaceWith != null) && !replaceWith.equals(classLiteral)) ? GWT.create(GwtReflectionUtils
    //                .getClass(replaceWith)) : null;
    return ((replaceWith != null) && !replaceWith.equals(classLiteral.getCanonicalName())) ? GWT
            .create(GwtReflectionUtils.getClass(replaceWith)) : null;

}

GwtTestPatchException: Error while defining com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer from modified bytecode

What steps will reproduce the problem?

  1. I Use gwt 2.5.1 (user / dev / servlet) in my project
  2. I Use gwt test utils 0.44
  3. I use gxt 3.0.0 in my project
  4. I run this test "BadTest" in attached file

package com.cacf.one.client.desktopapp;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.cacf.one.AbstractGwtTest;
import com.cacf.one.client.desktopapp.BusinessContextPresenter;
import com.cacf.one.client.desktopapp.BusinessContextViewImpl;
import com.cacf.one.client.param.PortalBusinessContextApplicationParameter;
import com.cacf.one.client.param.PortalParameters;
import com.google.gwt.user.client.ui.ListBox;
import com.googlecode.gwt.test.Mock;

public class BusinessContextViewImplTest extends AbstractGwtTest {

// class to test
private BusinessContextViewImpl businessContextViewImpl;

@Mock
BusinessContextPresenter businessContextPresenter;

@Before
public void setUp() throws Exception {

    businessContextViewImpl = new BusinessContextViewImpl(businessContextPresenter);

}

@After
public void tearDown() throws Throwable {
    reset();
}

@Test
public void checkPortalLayoutComboBox() throws Exception {

    // Add listBusinessContexts
    PortalBusinessContextApplicationParameter portalBusinessContextApplicationParameter = new PortalBusinessContextApplicationParameter();
    portalBusinessContextApplicationParameter.setId("idContext");

    List<PortalBusinessContextApplicationParameter> lstPortalBusiness = new ArrayList<PortalBusinessContextApplicationParameter>();
    lstPortalBusiness.add(portalBusinessContextApplicationParameter);

    PortalParameters.setBusinessContextId("idContext");
    PortalParameters.setListBusinessContexts(lstPortalBusiness);

    ListBox listBox = businessContextViewImpl.getPortalLayoutComboBox();
}

}

5 : With : "BusinessContextViewImpl" in attached file

package com.cacf.one.client.desktopapp;

import java.util.List;

import com.cacf.one.client.desktopapp.images.DesktopImages;
import com.cacf.one.client.param.PortalBusinessContextApplicationParameter;
import com.cacf.one.client.param.PortalParameters;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;

public class BusinessContextViewImpl implements BusinessContextView {

private BusinessContextPresenter businessContextPresenter;

private Window window;
private VerticalLayoutContainer verticalLayoutContainer;
private VerticalLayoutData layoutData;
private Margins margins;
private ListBox portalLayoutComboBox;
private TextButton cancelButton;
private SelectHandler cancelButtonSelectHandler;
private TextButton okayButton;
private SelectHandler okayButtonSelectHandler;

public BusinessContextViewImpl(BusinessContextPresenter businessContextPresenter) {
this.businessContextPresenter = businessContextPresenter;
}

@OverRide
public void show() {
getWindow().setFocusWidget(getPortalLayoutComboBox());
getWindow().show();
}

ListBox getPortalLayoutComboBox() {
if (portalLayoutComboBox == null) {

    List<PortalBusinessContextApplicationParameter> listBusinessContexts = PortalParameters.getListBusinessContexts();

    portalLayoutComboBox = new ListBox();
    for (PortalBusinessContextApplicationParameter portalParam : listBusinessContexts){
        if (!PortalParameters.getBusinessContextId().equals(portalParam.getId())){
            portalLayoutComboBox.addItem(portalParam.getName(), portalParam.getId());
        }
    }

}
return portalLayoutComboBox;

}

private TextButton getCancelButton() {
if (cancelButton == null) {
cancelButton = new TextButton("Cancel");
cancelButton.addSelectHandler(getCancelButtonSelectHandler());
}
return cancelButton;
}

private SelectHandler getCancelButtonSelectHandler() {
if (cancelButtonSelectHandler == null) {
cancelButtonSelectHandler = new SelectHandler() {
@OverRide
public void onSelect(SelectEvent event) {
getBusinessContextPresenter().onCancel();
}
};
}
return cancelButtonSelectHandler;
}

private VerticalLayoutData getLayoutData() {
if (layoutData == null) {
layoutData = new VerticalLayoutData(1, -1, getMargins());
}
return layoutData;
}

private Margins getMargins() {
if (margins == null) {
margins = new Margins(5);
}
return margins;
}

private TextButton getOkayButton() {
if (okayButton == null) {
okayButton = new TextButton("Go");
okayButton.addSelectHandler(getSubmitButtonSelectHandler());
}
return okayButton;
}

private SelectHandler getSubmitButtonSelectHandler() {
if (okayButtonSelectHandler == null) {
okayButtonSelectHandler = new SelectHandler() {
@OverRide
public void onSelect(SelectEvent event) {
getBusinessContextPresenter().onSubmit(portalLayoutComboBox.getValue(portalLayoutComboBox.getSelectedIndex()));
getBusinessContextPresenter().onCancel();
}
};
}
return okayButtonSelectHandler;
}

private BusinessContextPresenter getBusinessContextPresenter() {
return businessContextPresenter;
}

private VerticalLayoutContainer getVerticalLayoutContainer() {
if (verticalLayoutContainer == null) {
verticalLayoutContainer = new VerticalLayoutContainer();
VerticalLayoutData layoutDataLabel = new VerticalLayoutData(1, 0.3);
layoutDataLabel.setMargins(new Margins(20,10,20,10));
verticalLayoutContainer.add(new Label("Test :"), layoutDataLabel);
verticalLayoutContainer.add(getPortalLayoutComboBox(), getLayoutData());

}
return verticalLayoutContainer;

}

private Window getWindow() {
if (window == null) {
window = new Window();
window.getHeader().setIcon(DesktopImages.INSTANCE.user_edit());
window.setPixelSize(270, 190);
window.setButtonAlign(BoxLayoutPack.CENTER);
window.setModal(true);
window.setBlinkModal(true);
window.setClosable(false);
window.setOnEsc(false);
window.add(getVerticalLayoutContainer());
window.addButton(getCancelButton());
window.addButton(getOkayButton());
}
return window;
}

@OverRide
public void hide() {
// TODO Auto-generated method stub

}

@OverRide
public void onValidationError() {
// TODO Auto-generated method stub

}

}

What is the expected output? What do you see instead?
I get the error :

com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while defining com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer from modified bytecode
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:200)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.cacf.one.client.desktopapp.BadTest.setUp(BadTest.java:25)
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:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while defining com.sencha.gxt.widget.core.client.container.InsertResizeContainer from modified bytecode
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:200)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:196)
... 31 more
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while defining com.sencha.gxt.widget.core.client.container.ResizeContainer from modified bytecode
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:200)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:196)
... 38 more
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while defining com.sencha.gxt.widget.core.client.container.Container from modified bytecode
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:200)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:196)
... 45 more
Caused by: java.lang.NullPointerException
at com.googlecode.gwt.test.internal.rewrite.OverlayTypesRewriter$MyInstanceMethodOracle.findOriginalDeclaringClass(OverlayTypesRewriter.java:111)
at com.googlecode.gwt.test.internal.rewrite.RewriteRefsToJsoClasses$MyMethodAdapter.visitMethodInsn(RewriteRefsToJsoClasses.java:78)
at com.google.gwt.dev.asm.ClassReader.accept(ClassReader.java:1371)
at com.google.gwt.dev.asm.ClassReader.accept(ClassReader.java:420)
at com.googlecode.gwt.test.internal.rewrite.OverlayTypesRewriter.rewrite(OverlayTypesRewriter.java:578)
at com.googlecode.gwt.test.internal.GwtClassLoader$GwtClassLoaderWithRewriter.findClassBytes(GwtClassLoader.java:100)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:180)
at javassist.Loader.loadClass(Loader.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:196)
... 52 more

Please provide any additional information below:

This test run perfectly with gwt 2.4.0 and gwt-test-utils 0.42

Please Help me !!!!!

No code coverage data

I recently switched to gwt 2.6.1 and gwt-test-util 0.47 : I can't get any coverage data (in Eclipse or Sonar)

The jacoco.exec file seems to show that classes were instrumented, but I got no coverage data (I also checked that tests are executed correctly)

I updated to the last available Jacoco-maven-plugin.

I use JUnit 4.10

Do you have any idea regarding this issue?

Does gwt-test-util test case invokes onModuleLoad?

I am wondering whether running a test case written using gwt-test-utils parses *.gwt.xml and go through onModuleLoad() method.

This is because, I have a factory class and its implementation which creates all views in my application.

This factory class is defined in *.gwt.xml as


The same factory class is deferred binding created in onModuleLoad() as
public static ClientFactory clientFactory = null;
public void onModuleLoad(){
clientFactory = GWT.create(ClientFactory.class); //Note that it is not Impl class.
}

My view impl class uses this client factory to get the other views created.

MyViewImpl{

public void refreshView()[
    MySecondView  mySecondView = OnModuleLoadClass.clientFactory.getMySecondView();  //This should return MySecondViewImpl.
}

}

MyViewImplTest{

MyViewImpl myViewImpl

@before
public void init()[
     myViewImpl = new MyViewImpl();
     myViewImpl.refreshView();  //This is throwing NullPointerException as clientFactory in refreshView is coming null.
}

}

I initially thought of Mocking the ClientFactory. But mocking didn't help because client factory is not set in the ViewImpl but accessed statically from OnModuleLoad class.

Is it a solvable issue within test class or a design smell?

com.googlecode.gwt.test.exceptions.GwtTestPatchException: javassist.NotFoundException: com.google.gwt.i18n.client.impl.LocaleInfoImpl_shared

I am trying to write an EntryPoint Test

I get an error about Locale (see stack below)

When i try to define a locale in gwt.xml, i get the same error, plus this warning on the console

 Unable to get locale properties, using defaults
com.google.gwt.core.ext.BadPropertyValueException: Property 'locale' cannot be set to unexpected value '<failed to compute>

Stack:

com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, com.googlecode.gwt.test.exceptions.GwtTestDeferredBindingException: No declared GwtCreateHandler has been able to create an instance of 'com.mycompany.myapp.client.ui.presenter.region.SeparatorPresenterFactory'. You should add our own with TestMain.addGwtCreateHandler(..) method or declared your tested object with @Mock
  at com.googlecode.gwt.test.gin.DeferredBindingModule.addDeferredBinding(DeferredBindingModule.java:162)
  while locating com.mycompany.myapp.client.ui.presenter.region.SeparatorPresenterFactory
    for parameter 0 at com.mycompany.myapp.client.ui.presenter.region.RootPresenter.<init>(RootPresenter.java:17)
  while locating com.mycompany.myapp.client.ui.presenter.region.RootPresenter
  while locating com.mycompany.myapp.client.ui.view.root.RootView$Presenter
    for parameter 1 at com.mycompany.myapp.client.ApplicationContextImpl.<init>(ApplicationContextImpl.java:29)
  while locating com.mycompany.myapp.client.ApplicationContextImpl
  at com.mycompany.myapp.client.inject.Module.bindContext(Module.java:97)
  while locating com.mycompany.myapp.client.ApplicationContext

1 error
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
    at com.googlecode.gwt.test.gin.GinInjectorInvocationHandler.invoke(GinInjectorInvocationHandler.java:32)
    at com.sun.proxy.$Proxy100.getApplication(Unknown Source)
    at com.mycompany.myapp.client.TestMain.test(TestMain.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    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: com.googlecode.gwt.test.exceptions.GwtTestDeferredBindingException: No declared GwtCreateHandler has been able to create an instance of 'com.mycompany.myapp.client.ui.presenter.region.SeparatorPresenterFactory'. You should add our own with TestMain.addGwtCreateHandler(..) method or declared your tested object with @Mock
    at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.create(GwtTestGWTBridge.java:112)
    at com.google.gwt.core.shared.GWT.create(GWT.java:57)
    at com.google.gwt.core.client.GWT.create(GWT.java:85)
    at com.googlecode.gwt.test.gin.DeferredBindingModule$DeferredBindingProvider.get(DeferredBindingModule.java:86)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    ... 33 more

java.lang.ExceptionInInitializerError
    at com.google.gwt.i18n.client.NumberFormat.<clinit>(NumberFormat.java:310)
    at sun.misc.Unsafe.ensureClassInitialized(Native Method)
    at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
    at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140)
    at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1057)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:1038)
    at java.lang.reflect.Field.set(Field.java:741)
    at com.googlecode.gwt.test.utils.GwtReflectionUtils.setStaticField(GwtReflectionUtils.java:600)
    at com.googlecode.gwt.test.GwtReset.reset(GwtReset.java:58)
    at com.googlecode.gwt.test.GwtTest.tearDownGwtTest(GwtTest.java:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    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: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while creating instance of 'com.google.gwt.i18n.client.impl.LocaleInfoImpl' through 'com.mycompany.myapp.client.GeneratorCreateHandlerWithoutCache' instance
    at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.create(GwtTestGWTBridge.java:106)
    at com.google.gwt.core.shared.GWT.create(GWT.java:57)
    at com.google.gwt.core.client.GWT.create(GWT.java:85)
    at com.google.gwt.i18n.client.LocaleInfo.<clinit>(LocaleInfo.java:36)
    ... 37 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: caught an exception while otaining a class file for generated class com.google.gwt.i18n.client.impl.LocaleInfoImpl_en_US
    at com.googlecode.gwt.test.internal.handlers.GeneratorCreateHandler.generate(GeneratorCreateHandler.java:92)
    at com.googlecode.gwt.test.internal.handlers.GeneratorCreateHandler.create(GeneratorCreateHandler.java:75)
    at com.mycompany.myapp.client.GeneratorCreateHandlerWithoutCache.create(GeneratorCreateHandlerWithoutCache.java:26)
    at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.create(GwtTestGWTBridge.java:95)
    ... 40 more
Caused by: java.lang.ClassNotFoundException: caught an exception while otaining a class file for generated class com.google.gwt.i18n.client.impl.LocaleInfoImpl_en_US
    at com.googlecode.gwt.test.internal.GwtClassLoader.findClassBytes(GwtClassLoader.java:225)
    at com.googlecode.gwt.test.internal.GwtClassLoader$GwtClassLoaderWithRewriter.findClassBytes(GwtClassLoader.java:97)
    at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:180)
    at javassist.Loader.loadClass(Loader.java:312)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.googlecode.gwt.test.internal.handlers.GeneratorCreateHandler.generate(GeneratorCreateHandler.java:90)
    ... 43 more
Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: javassist.NotFoundException: com.google.gwt.i18n.client.impl.LocaleInfoImpl_shared
    at com.googlecode.gwt.test.internal.PatcherFactory.createPatcher(PatcherFactory.java:38)
    at com.googlecode.gwt.test.internal.GwtTranslator.applyPatcher(GwtTranslator.java:61)
    at com.googlecode.gwt.test.internal.GwtTranslator.patchClass(GwtTranslator.java:83)
    at com.googlecode.gwt.test.internal.GwtTranslator.onLoad(GwtTranslator.java:35)
    at com.googlecode.gwt.test.internal.GwtClassLoader.applyPatchers(GwtClassLoader.java:274)
    at com.googlecode.gwt.test.internal.GwtClassLoader.findClassBytes(GwtClassLoader.java:223)
    ... 48 more
Caused by: javassist.NotFoundException: com.google.gwt.i18n.client.impl.LocaleInfoImpl_shared
    at javassist.ClassPool.get(ClassPool.java:440)
    at javassist.CtClassType.subtypeOf(CtClassType.java:315)
    at com.googlecode.gwt.test.internal.PatcherFactory.createPatcher(PatcherFactory.java:33)
    ... 53 more

com.google.gwt.http.client.URL

Hi

It seems that URL is not available from gwt-test-utils tests

java.lang.UnsatisfiedLinkError: com.google.gwt.http.client.URL.decodeImpl(Ljava/lang/String;)Ljava/lang/String;
at com.google.gwt.http.client.URL.decodeImpl(Native Method)
at com.google.gwt.http.client.URL.decode(URL.java:41)
at ...

gwt 2.6.0

Now that GWT 2.6.0 has been released, how can we expect a compatible release?
I can try to help if you need it.

regards,

Etienne Lacazedieu

Using Browser class throws org.fest.assertions.api.Fail ClassNotFoundException

My test method just got one line of code - Browser.click(myViewImpl.doneButton);

But running this with the "gwt-test-utils-0.41-20120905.060017-3.jar" is throwing the following exception. I tried adding fest-assert-1.4.jar and fest-util-1.1.6.jar into my classpath but no luck. Am I missing any other libraries?

java.lang.NoClassDefFoundError: org/fest/assertions/api/Fail
at com.googlecode.gwt.test.GwtTest$1.onError(GwtTest.java:47)
at com.googlecode.gwt.test.GwtModuleRunnerAdapter$BrowserErrorHandlerDelegate.onError(GwtModuleRunnerAdapter.java:42)
at com.googlecode.gwt.test.utils.events.Browser.canApplyEvent(Browser.java:847)
at com.googlecode.gwt.test.utils.events.Browser.dispatchEventsInternal(Browser.java:942)
at com.googlecode.gwt.test.utils.events.Browser.dispatchEvent(Browser.java:313)
at com.googlecode.gwt.test.utils.events.Browser.clickInternal(Browser.java:872)
at com.googlecode.gwt.test.utils.events.Browser.click(Browser.java:185)
at myTestClassPackage.MyViewImplTest.testGetSelectedItem(MyViewImplTest.java:45)
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.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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.ClassNotFoundException: org.fest.assertions.api.Fail
at com.googlecode.gwt.test.internal.GwtClassLoader.findClassBytes(GwtClassLoader.java:207)
at com.googlecode.gwt.test.internal.GwtClassLoader$GwtClassLoaderWithRewriter.findClassBytes(GwtClassLoader.java:86)
at com.googlecode.gwt.test.internal.GwtClassLoader.findClass(GwtClassLoader.java:157)
at javassist.Loader.loadClass(Loader.java:311)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 37 more

Running the same test with "gwt-test-utils-0.41.jar" is throwing different exception

com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating gwt-test-utils prerequisites
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:113)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:299)
at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
... 21 more

While the generated log says

09-17@16:54:22 ERROR main com.googlecode.gwt.test.GwtTreeLogger - Unexpected error while processing XML
java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at com.google.gwt.dev.util.xml.ReflectiveParser.createNewSaxParser(ReflectiveParser.java:65)
at com.google.gwt.dev.util.xml.ReflectiveParser.access$000(ReflectiveParser.java:46)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:343)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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)
09-17@16:54:48 ERROR main com.googlecode.gwt.test.GwtTreeLogger - Unexpected error while processing XML
java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at com.google.gwt.dev.util.xml.ReflectiveParser.createNewSaxParser(ReflectiveParser.java:65)
at com.google.gwt.dev.util.xml.ReflectiveParser.access$000(ReflectiveParser.java:46)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:343)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$200(ReflectiveParser.java:68)
at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:418)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:296)
at com.google.gwt.dev.cfg.ModuleDefLoader$2.load(ModuleDefLoader.java:217)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:324)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:107)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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)

UiBinderInvocationHandler should support classes that implement IsWidget too

com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler supports only subclasses Widget as the

com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.addHandlers(Object owner)

method iterates over the handler methods and extracts the target object it casts it into a Widget. This does not work with classes that are used as widget but they implement IsWidget interface instead of inheriting from the Widget class.
To fix it the following call

Widget uiField = GwtReflectionUtils.getPrivateFieldValue(owner, uiFieldName);

could be replaced with

Widget uiField = getWidget(owner, uiFieldName);

where getWidget method contains the instanceof ispection:

private Widget getWidget(Object owner, String uiFieldName) {
        Object widgetObject = GwtReflectionUtils.getPrivateFieldValue(owner, uiFieldName);
        Widget uiField;
        if (widgetObject instanceof Widget) {
            uiField = (Widget) widgetObject;
        } else if (widgetObject instanceof IsWidget) {
           uiField = ((IsWidget) widgetObject).asWidget();
        } else {
            throw new IllegalStateException("Unsupported ui class " + widgetObject.getClass());
        }
        return uiField;
    }

Are gin multibindings supported?

I use gin mulitbindings in my project. I ran into an exception when I start the tests:

    An exception was caught and reported. Message: null
  at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
Caused by: java.lang.NullPointerException
    at com.google.gwt.inject.client.multibindings.BindingRecorder.bind(BindingRecorder.java:42)
    at com.google.gwt.inject.client.multibindings.GinMultibinder.addBinding(GinMultibinder.java:151)

My test uses

 addGwtCreateHandler(new GInjectorCreateHandler());

Not able to reference Custom UI widgets

I have a created a new widget for my project and i am using the same in my View class. The custom widget accepts a widget created in ui.xml as UiTagAttribute. While initializing the SampleView through test class i get GWTBind Exception. This works perfectly in the live application (Source)

Below is a sample of the same.

CustomWidget {

private Widget control;

public void setControl(final Widget control) {
this.control = control;
}
}

SampleView.ui.xml

<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:cutromControl">

    <div class="left pointSection">
        <g:TextBox ui:field="testWidget" maxLength="5" styleName="pointsInput left"/>
        <c:CustomWidget ui:field="pointsLabel" control="{testWidget}" />
    </div>

/ui:UiBinder

While initializing SampleView I get the below error

com.googlecode.gwt.test.exceptions.GwtTestUiBinderException: Error in file 'SampleView.ui.xml' : no resource declared for alias 'testWidget'

Please help me to solve this

Binoy

Framework not identifying the source java class in another module.

Lets say a project got three modules in the workspace - ModuleUI, ModuleDomain and ModuleService. ModuleDomain doesn't have anything but DTOs. ModuleService instantiates the DTOs and calls the setters while ModuleUi uses the reference of the DTOs and calls their getters. Its straightforward and simple architecture.

When gwt-test-utils is used to test ModuleUI (which is a GWT project), it expects the DTOs from ModuleDomain available in source .java files. It seems it is not considering the ModuleDomain referred in Eclipse's java build path under projects.

As a workaround, I am creating a jar of source java files of DTO's and adding that jar into ModuleUI classpath. Tests go fine.

Question: Making the domain objects (DTOs) availble to UI module in the form of a jar is the only way and simply referring the domain project can't be done?

Patchers to TableCellElement?

Would it be possible to add other patch methods to TableRowElement class? Right now com.googlecode.gwt.test.internal.patchers.dom.TableRowElementPatcher contains patcher for getCells() & getSectionRowIndex() methods while TableRowElement class has around 13 native methods.

Thanks
Shivakumar

Running a test fails in path containing space (through Maven on Windows)

(I don't yet have a small reproduction scenario, but perhaps the following info is enough already.)

Using gwt-test-utils 0.43 through Maven on Windows, running a very simple tests fails during initialization, as shown in the stack trace in the Surefire output file below.

The cause seems to be that the path contains a space, and that space is somewhere morphed into a %20, and then the path .../new%20desk/... cannot be found.

-------------------------------------------------------------------------------
Test set: com.infor.ion.desk.roles.ui.server.UITest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.197 sec <<< FAILURE!
initializationError(com.infor.ion.desk.roles.ui.server.UITest)  Time elapsed: 0.001 sec  <<< ERROR!
com.googlecode.gwt.test.exceptions.GwtTestException: Error while parsing maven-surefire-plugin booter jar: /C:/dev/new%20desk/com.infor.ion.desk.roles.ui/target/surefire/surefirebooter109899739406582732.jar
    at com.googlecode.gwt.test.internal.ConfigurationLoader.extractSrcUrlsFromBooterJar(ConfigurationLoader.java:144)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.processRelatedProjectSrcDirectories(ConfigurationLoader.java:179)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.<init>(ConfigurationLoader.java:65)
    at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:87)
    at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
    at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
    at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
    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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokePro   vider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Caused by: java.io.FileNotFoundException: C:\dev\new%20desk\com.infor.ion.desk.roles.ui\target\surefire\surefirebooter109899739406582732.jar (The system cannot find the path specified)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:72)
    at com.googlecode.gwt.test.internal.ConfigurationLoader.extractSrcUrlsFromBooterJar(ConfigurationLoader.java:130)
    ... 28 more

Problem with ui:attribute in TextBox

Hello,
I have a problem with my code:

<g:TextBox required="false" ui:field="maxNormText" title="" text="">
    <ui:attribute name="text" key="cm_geometry_maxnorm_title" />
</g:TextBox>

I'am using GWT 2.5.1 and gwt-test-utils 0.45.

Everything works fine when I run application, but runing a test based on gwt-test-utils gives this Exception:
com.googlecode.gwt.test.exceptions.GwtTestUiBinderException: Found unexpected child element : urn:ui:com.google.gwt.uibinder:attribute in com.google.gwt.user.client.ui.TextBox
at com.googlecode.gwt.test.uibinder.UiObjectTag.appendElement(UiObjectTag.java:175)
at com.googlecode.gwt.test.uibinder.UiObjectTag.addElement(UiObjectTag.java:62)
at com.googlecode.gwt.test.uibinder.UiTagBuilder.endTag(UiTagBuilder.java:110)
at com.googlecode.gwt.test.uibinder.UiXmlContentHandler.endElement(UiXmlContentHandler.java:41)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.googlecode.gwt.test.uibinder.UiBinderParser.createUiComponent(UiBinderParser.java:50)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.createAndBindUi(UiBinderInvocationHandler.java:83)
at com.googlecode.gwt.test.uibinder.UiBinderInvocationHandler.invoke(UiBinderInvocationHandler.java:34)
at pl.cyfronet.insilicolab.client.ui.wizard.$Proxy53.createAndBindUi(Unknown Source)
at pl.cyfronet.insilicolab.client.ui.wizard.CMGeometryPanel.(CMGeometryPanel.java:34)
at pl.cyfronet.insilicolab.client.ui.wizard.ApplicationInputWizardTest.applicationInputWizard(ApplicationInputWizardTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at com.googlecode.gwt.test.internal.junit.GwtBlockJUnit4ClassRunner.run(GwtBlockJUnit4ClassRunner.java:27)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.run(AbstractGwtRunner.java:47)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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)

UiTagBuilder incorrectly parses attribute when elements are separated by more than one space

Given the following element definition from a ui.xml:

<g:HTMLPanel addStyleNames="float-left  {style.panel-font}" />

When I create a GwtTest that uses the a class that uses UiBinder to build the corresponding view and there is more than one space between the style names in the double quote, it's getting parsed into an array of String with three elements an empty String being at index 1. When these style names later passed to

com.google.gwt.user.client.ui.UIObject.setStyleName(Element elem, String style, boolean add)

method the empty one will cause an

new IllegalArgumentException(EMPTY_STYLENAME_MSG)

to be thrown.

The cause is in

com.googlecode.gwt.test.uibinder.UiTagBuilder.treatAddStyleNamesAttr(String attrValue, Map<String, Object> attributesMap)

method when the attribute value is split using

attrValue.trim().split(" ");

I suggest to use

attrValue.trim().split("[,\\s]+")

just like in

com.google.gwt.uibinder.rebind.XMLElement.consumeRawArrayAttribute(String name)

HTML element class names being mangled when UIBinder used to create view

I have a view defined using UIBinder. The View's .ui.xml file contains a table with the following row:

<tr ui:field="errorRow" class="errorRow hidden">
     <td colspan="2" ui:field="errorCell" class="error errorRow"></td>
</tr>

Note that both the "tr" and "td" elements have a pair of CSS class names assigned, separated by spaces as is normally the case with HTML and CSS.

The corresponding Java view class has members:

    @UiField
    TableRowElement errorRow;

    @UiField
    TableCellElement errorCell;

When I am attempting to unit test an aspect of the corresponding view class, after the Java class has been created (via its constructor, which calls

initWidget(uiBinder.createAndBindUi(this));

as usual, the errorRow element contains:

<tr class="errorRowhidden"><td colspan="2" class="errorerrorRow"></td></tr>

Note that the space between the class names has been deleted, thus altering the pair of CSS class names into a single CSS class name. This is the value then returned by errorRow.getClassName() or errorCell.getClassName(). This then causes errors in the unit tests, which expect to find the individual, separate CSS class names on the elements.

If this same class is instead created via a GWTUnitTest-derived unit test, errorRow.getClassName() and errorCell.getClassName() return the correct values, with the space.

This suggests that the "replacement" classes being used by gwt-test-utils have a bug in their attribute parsing logic.

GWT 2.5 and gwt-test-util .43 migration.

Migrating to GWT 2.5 and gwt-test-utils .43 means getting the latest GWT eclipse plugin and replace the current gwt-test-utils jar with the .43 version?

It seems just doing that doesn't sufficient because I am getting gwt-test-utils initialization error.

error will be either
java.lang.NoClassDefFoundError: com/google/gwt/dev/javac/rebind/RebindCache
at com.googlecode.gwt.test.internal.handlers.GeneratorCreateHandler.(GeneratorCreateHandler.java:57)
at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.(GwtTestGWTBridge.java:61)
at com.googlecode.gwt.test.internal.handlers.GwtTestGWTBridge.(GwtTestGWTBridge.java:35)
at com.googlecode.gwt.test.GwtTestWithMocks.(GwtTestWithMocks.java:56)
at com.googlecode.gwt.test.GwtTestWithEasyMock.(GwtTestWithEasyMock.java:47)

or

java.lang.NoClassDefFoundError: com/google/gwt/core/ext/typeinfo/TypeOracle
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at

Am I missing any step?

using gwt-maven-plugin compileSourcesArtifacts causes java.lang.ArrayIndexOutOfBoundsException:

If I try to make use of the gwt-maven-plugin compileSourcesArtifacts to avoid having to include java source in my primary jar file, the test cases that previously worked now throw this exception.

java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
at com.googlecode.gwt.test.GwtTreeLogger.doLog(GwtTreeLogger.java:93)
at com.google.gwt.dev.util.log.AbstractTreeLogger.log(AbstractTreeLogger.java:213)
at com.google.gwt.core.ext.TreeLogger.log(TreeLogger.java:281)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:281)
at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:98)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:192)
at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:103)
at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:158)
at com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:105)
at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:45)
at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.(AbstractGwtRunner.java:30)
at com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
at sun.reflect.GeneratedConstructorAccessor21.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.