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
}
}
誰かがこれを修正するのを手伝ってくれますか? どうも!