use of org.jmock.Mockery in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method setup.
@Before
public void setup() {
mockContext = new Mockery();
mockContext.setImposteriser(ClassImposteriser.INSTANCE);
mockContext.setThreadingPolicy(new Synchroniser());
}
use of org.jmock.Mockery in project geode by apache.
the class ListIndexFunctionJUnitTest method setup.
@Before
public void setup() {
mockContext = new Mockery() {
{
setImposteriser(ClassImposteriser.INSTANCE);
setThreadingPolicy(new Synchroniser());
}
};
mockCounter = new AtomicLong(0l);
}
use of org.jmock.Mockery in project geode by apache.
the class LoginHandlerInterceptorJUnitTest method setUp.
@Before
public void setUp() {
mockContext = new Mockery();
mockContext.setImposteriser(ClassImposteriser.INSTANCE);
mockContext.setThreadingPolicy(new Synchroniser());
LoginHandlerInterceptor.getEnvironment().clear();
}
use of org.jmock.Mockery in project sling by apache.
the class InitResourceTest method setup.
@Before
public void setup() throws Exception {
context = new Mockery();
req = context.mock(HttpServletRequest.class);
resp = context.mock(HttpServletResponse.class);
resourceResolver = context.mock(ResourceResolver.class);
context.checking(new Expectations() {
{
allowing(req).getRequestURL();
will(returnValue(new StringBuffer(requestURL)));
allowing(req).getRequestURI();
allowing(req).getPathInfo();
will(returnValue(pathInfo));
allowing(req).getServletPath();
will(returnValue("/"));
allowing(req).getMethod();
will(returnValue("GET"));
allowing(req).getAttribute(RequestData.REQUEST_RESOURCE_PATH_ATTR);
will(returnValue(null));
allowing(req).setAttribute(with(equal(RequestData.REQUEST_RESOURCE_PATH_ATTR)), with(any(Object.class)));
allowing(req).getAttribute(RequestProgressTracker.class.getName());
will(returnValue(null));
// Verify that the ResourceResolver is called with the expected path
allowing(resourceResolver).resolve(with(any(HttpServletRequest.class)), with(equal(expectedResolvePath)));
}
});
requestData = new RequestData(null, req, resp);
}
use of org.jmock.Mockery in project sling by apache.
the class RequestDataTest method setup.
@Before
public void setup() throws Exception {
context = new Mockery() {
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
req = context.mock(HttpServletRequest.class);
resp = context.mock(HttpServletResponse.class);
final ContentData contentData = context.mock(ContentData.class);
final Servlet servlet = context.mock(Servlet.class);
final ServletConfig servletConfig = context.mock(ServletConfig.class);
context.checking(new Expectations() {
{
allowing(req).getServletPath();
will(returnValue("/"));
allowing(req).getPathInfo();
will(returnValue(""));
allowing(req).getMethod();
will(returnValue("GET"));
allowing(req).setAttribute(with(any(String.class)), with(any(Object.class)));
allowing(req).setAttribute(with(any(String.class)), with(aNull(Object.class)));
allowing(contentData).getServlet();
will(returnValue(servlet));
allowing(servlet).getServletConfig();
will(returnValue(servletConfig));
allowing(servlet).service(with(any(ServletRequest.class)), with(any(ServletResponse.class)));
allowing(servletConfig).getServletName();
will(returnValue("SERVLET_NAME"));
allowing(req).getAttribute(RequestProgressTracker.class.getName());
will(returnValue(null));
}
});
requestData = new RequestData(null, req, resp) {
@Override
public ContentData getContentData() {
return contentData;
}
};
slingRequest = new SlingHttpServletRequestImpl(requestData, req);
slingResponse = new SlingHttpServletResponseImpl(requestData, resp);
RequestData.setMaxCallCounter(2);
}
Aggregations