@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
ParamEncoder encoder = new ParamEncoder("table");
// page 1, not sorted
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");
checkNumberOfIterations(runner.getResponse(request), 1);
// page 2, not sorted
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
checkNumberOfIterations(runner.getResponse(request), 1);
// page 1, sorted (only current page)
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "1");
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");
checkNumberOfIterations(runner.getResponse(request), 1);
// page 2, sorted (only current page)
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "1");
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
checkNumberOfIterations(runner.getResponse(request), 1);
// page 1, export single page
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
request.setParameter(
encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE),
Integer.toString(MediaTypeEnum.CSV.getCode()));
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");
WebResponse response = runner.getResponse(request);
String csvExport = response.getText();
if (log.isDebugEnabled())
{