TestAbstractGdataServletpublic class TestAbstractGdataServlet extends TestCase
Fields Summary |
---|
private static final String | METHOD_DELETE | private static final String | METHOD_GET | private static final String | METHOD_POST | private static final String | METHOD_PUT | private static final String | METHOD_HEADER_NAME | private HttpServletRequest | mockRequest | private HttpServletResponse | mockResponse | private AbstractGdataServlet | servletInstance | private org.easymock.MockControl | requestMockControl | private org.easymock.MockControl | responseMockControl |
Methods Summary |
---|
protected void | setUp()
this.requestMockControl = MockControl
.createControl(HttpServletRequest.class);
this.responseMockControl = MockControl
.createControl(HttpServletResponse.class);
this.mockRequest = (HttpServletRequest) this.requestMockControl
.getMock();
this.mockResponse = (HttpServletResponse) this.responseMockControl
.getMock();
this.servletInstance = new StubGDataServlet();
| public void | testServiceHttpServletRequestHttpServletResponseDelete()Test method for
'org.apache.lucene.gdata.servlet.AbstractGdataServlet.service(HttpServletRequest,
HttpServletResponse)'
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_DELETE);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_DELETE);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
this.requestMockControl.reset();
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_POST);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_DELETE);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
| public void | testServiceHttpServletRequestHttpServletResponseGET()Test method for
'org.apache.lucene.gdata.servlet.AbstractGdataServlet.service(HttpServletRequest,
HttpServletResponse)'
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_GET);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_GET);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
this.requestMockControl.reset();
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_POST);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_GET);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
| public void | testServiceHttpServletRequestHttpServletResponsePOST()Test method for
'org.apache.lucene.gdata.servlet.AbstractGdataServlet.service(HttpServletRequest,
HttpServletResponse)'
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_POST);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_POST);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
this.requestMockControl.reset();
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_PUT);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_POST);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
| public void | testServiceHttpServletRequestHttpServletResponsePUT()Test method for
'org.apache.lucene.gdata.servlet.AbstractGdataServlet.service(HttpServletRequest,
HttpServletResponse)'
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_PUT);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_PUT);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
this.requestMockControl.reset();
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_POST);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), METHOD_PUT);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
| public void | testServiceNullOverrideHeader()
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getMethod(), METHOD_POST);
this.requestMockControl.expectAndDefaultReturn(this.mockRequest
.getHeader(METHOD_HEADER_NAME), null);
this.requestMockControl.replay();
try {
this.servletInstance.service(this.mockRequest, this.mockResponse);
} catch (ServletException e) {
fail("ServeltExpception not expected");
} catch (IOException e) {
fail("IOExpception not expected");
}
this.requestMockControl.verify();
this.requestMockControl.reset();
|
|