Я использую Mockito для тестирования моего проекта GWTP, и у меня есть ошибка:
com.google.inject.CreationException: Guice creation errors:
1) No implementation for javax.servlet.http.HttpServletRequest was bound.
while locating com.google.inject.Provider<javax.servlet.http.HttpServletRequest>
for parameter 0 at com.gwtplatform.dispatch.server.guice.request.DefaultRequestProvider.<init>(DefaultRequestProvider.java:35)
at com.gwtplatform.dispatch.server.guice.DispatchModule.configure(DispatchModule.java:135)
Ниже приведен код для модульного теста:
@Mock
private TestActionHandler mockTestActionHandler;
@Before
public void setUp() {
Injector injector = Guice.createInjector(new ServerModule(), new MockHandlerModule() {
@Override
protected void configureMockHandlers() {
bindMockActionHandler(TestActionHandler.class,
mockTestActionHandler);
}
});
}
Вот код для TestActionHandler:
public class TestActionHandler implements ActionHandler<TestAction, TestResult> {
private final Provider<HttpServletRequest> provider;
@Inject
public RetrieveEventsUsingCategoryIdActionHandler(
final Provider<HttpServletRequest> provider) {
this.provider = provider;
}
@Override
public TestResult execute(TestAction action, ExecutionContext context) {
//handle action
}
}
Может кто-нибудь помочь мне исправить это?Большое спасибо!