I've a problem with GWT unit test, this is the code
StudenteServiceAsync service;
public void gwtSetUp(){
// Create the service that we will test.
service = GWT.create(StudenteService.class);
ServiceDefTarget target = (ServiceDefTarget) service;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "progettosweng/studenti");
}
@Override
public String getModuleName() {
return "com.university";
}
@Test
public synchronized void getNumeroStudenti() throws Exception {
delayTestFinish(10000);
service.getNumeroStudenti(new AsyncCallback<Integer>() {
@Override
public void onFailure(Throwable caught) {
fail("FAIL: getNumeroStudenti");
}
@Override
public void onSuccess(Integer result) {
assertTrue(true);
}
});
}
}
when start test, it gives me an error:
java.lang.NullPointerException: Cannot invoke "com.university.client.services.StudenteServiceAsync.getNumeroStudenti(com.google.gwt.user.client.rpc.AsyncCallback)" because "this.service" is null
For me the error is never go in gwtSetUp() and the service is ever null. what should I do? thanks