Hello,


I recently started to work on a GXT 3.1.4, GWT 2.7.0 project. I'd like to introduce unit tests (TDD is my aim), so I pick gwt-mockito and do some experimentation. GWT widgets are mocked fine, but not GXT ones. See, here is my dummy widget:
public class SomePanel {


private HorizontalPanel pnl;
private Button btn;
private Label lbl;
private TextButton displaySome;


public SomePanel() {
pnl = new HorizontalPanel();
btn = new Button("Hey");
lbl = new Label("Unclicked");
btn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if ("Unclicked".equals(lbl.getText())) {
lbl.setText("Clicked");
} else {
lbl.setText("Unclicked");
}
}
});
displaySome = new TextButton("Display some.");
}


public HorizontalPanel getPnl() {
return pnl;
}


public Button getBtn() {
return btn;
}


public Label getLbl() {
return lbl;
}


public TextButton getDisplaySome() {
return displaySome;
}
}

And here is my unit test:
@RunWith(GwtMockitoTestRunner.class)
public class SomePanelTest {


private SomePanel pnl;


@Test
public void checkLabels() {
pnl = new SomePanel();
Assert.assertEquals("Unclicked", pnl.getLbl().getText());
pnl.getBtn().click();
Assert.assertEquals("Clicked", pnl.getLbl().getText());
pnl.getBtn().click();
Assert.assertEquals("Unclicked", pnl.getLbl().getText());
Assert.assertEquals("Display", pnl.getDisplaySome().getText());
}
}

When I run it, test raises the following exception:
java.lang.NullPointerExceptionat com.sencha.gxt.core.client.resources.CommonStyles.get(CommonStyles.java:96)
at com.sencha.gxt.widget.core.client.cell.CellComponent.createDefaultWrapperElement(CellComponent.java:55)
at com.sencha.gxt.widget.core.client.cell.CellComponent.<init>(CellComponent.java:141)
at com.sencha.gxt.widget.core.client.button.CellButtonBase.<init>(CellButtonBase.java:44)
at com.sencha.gxt.widget.core.client.button.TextButton.<init>(TextButton.java:35)
at com.sencha.gxt.widget.core.client.button.TextButton.<init>(TextButton.java:25)
at edu.me.gwt.client.SomePanel.<init>(SomePanel.java:32)
...
I can't get what is wrong. Do I miss something or is this the right way to do unit testing with GXT?