Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:32:30+00:00 2026-05-27T11:32:30+00:00

I am using Mockito to test my GWTP project and I got some error:

  • 0

I am using Mockito to test my GWTP project and I got some error:

    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)

Below is the code for unit test:

@Mock
private TestActionHandler mockTestActionHandler;

@Before
public void setUp() {
    Injector injector = Guice.createInjector(new ServerModule(), new MockHandlerModule() {

        @Override
        protected void configureMockHandlers() {
                bindMockActionHandler(TestActionHandler.class, 
                        mockTestActionHandler);
            }
        }); 
}

Here is the code for 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
    }
}

Could anyone help me fix this? Thaks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:32:30+00:00Added an answer on May 27, 2026 at 11:32 am

    Thanks to dinde’s post in GWTP group, I have resolved this problem.

    It seems that the test is complaining about missing Provider for HttpServletRequest, so in the setUp of the test, I add a provider fo the HttpServletRequest and the problem is solved. Here’s the working code:

    @Mock
    private TestActionHandler mockTestActionHandler;
    @Mock
    private HttpServletRequest servletRequest;
    
    @Before
    public void setUp() {
        Injector injector = Guice.createInjector(new ServerModule(), new MockHandlerModule() {
    
            @Override
            protected void configureMockHandlers() {
                    bindMockActionHandler(TestActionHandler.class, 
                            mockTestActionHandler);
                }
            });
    
            @SuppressWarnings("unused")
            @Provides 
            public HttpServletRequest createServletRequest() { 
                return servletRequest; 
            } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test some legacy code, using Mockito. I want to stub a
I'm trying to test-drive some Scala code using Specs2 and Mockito. I'm relatively new
I'm using the Mockito library for Java testing and getting errors in Mockito when
I'm trying to create a test using Mockito, however I'm getting a NullPointerException. The
I'm using mockito to test a legacy JAAS/LDAP login module. The javax.security.auth.callback.CallbackHandler interface defines
I'm writing a JUnit test and also using Mockito, and I want to call
I need mock some class with final method using mockito. I have wrote something
I am trying to write some test code for my java application using Scalatest.
I've been trying to get to mock a method with vararg parameters using Mockito:
Using C# .NET 3.5 and WCF, I'm trying to write out some of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.