views:

15

answers:

0

Hello,

I'm trying to mock an HTTPServletRequest data on my development GAE server. I'm running Eclipse Plugin 1.3.7

I've tried to do this:

package com.FOO.madservice.servlet.mock;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static org.mockito.Mockito.*;

@SuppressWarnings("serial")
public class BAR2ServletMock extends HttpServlet {
    ...
    protected HttpServletRequest requestFilter(HttpServletRequest req) {
        HttpServletRequest servletRequest = spy(req);

        doReturn("gzip, deflate").when(servletRequest).getHeader("header-name-goes-here");
        doReturn("174.30.216.4").when(servletRequest).getRemoteAddr();

        return servletRequest;
    }
    ...
}

Running the following gives exception:

java.lang.NoClassDefFoundError: sun.reflect.ReflectionFactory is a restricted class. Please see the Google App Engine developer's guide for more details.

Any ideas on how to disable class while list checking on GAE development server or perhaps using a different mocking library that works with GAE?

Thanks, Maxim.