hared: new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/my/relative/uri) new ResourceRequest(sharedEnvironment, Method.GET, "/my/relative/uri) { @Override protected void prepareRequest(EnhancedMockHttpServletRequest request) { request.addQueryParameter("foo", "123"); request.addHeader("Accept-Language", "en_US, de"); } @Override protected void onResponse(EnhancedMockHttpServletResponse response) { assert response.getStatus() == 200; assert response.getContentAsString().equals("foobar"); } }.run(); } }
Note that in a SeamTest the (mock) HTTP session is always shared between all requests in a particular test method. Each test method however executes with a new (mock) HTTP session. Design your tests accordingly, this is not configurable.
IMPORTANT: A ResourceRequest has to be executed in a @Test method or in a @BeforeMethod callback. You can not execute it in any other callback, such * as @BeforeClass.
@author Christian Bauer